[置顶] sql学习日志1
2017-10-12 18:07
477 查看
select
create drop alter
insert update delete
grant revoke
create schema __ drop schema __ 创建模式
create table __ drop table __ alter table 创建删除修改表
create view __ drop view 视图
crate index __ drop index 索引
create schema "S-T" authorization Wang
caeate schema authorization Wang
drop schema Wang cascade 无限制删除
cascade cascade cascade
restrict 限制
caeate table student
(Sno char(9) primary key,
Sname char(20) unique,
);
alter table Student add s_entrence date 增加属性列
alter table Student alter column Sage int 改变列的数据类型
alter table Course add unique(Cname) 增加唯一性约束
restrict
create cluster index Stusname on Student(Sname) // 聚簇索引
create unique index Stusno on Student(Sno) //默认升序建立索引
create unique index SCno on SC(Sno asc, Cno desc) //Sno 升序 Cno 降序
drop index Stusno
distinct
创建视图
create view is_student
AS
select sno, sname, sage
from student
where sdept = 'is';
drop table student restrict; //限制删除基本表
creat cluster index stuname on student(sname) 建立聚簇索引
一个基本表只能建立一个聚簇索引,建立索引为了提高查询效率
drop index stuname;
select distinct sno from SC 消除重复的行
降序排列 order by子句
select sno, grade
from SC
where cno = '3'
order by grade desc
count sum avg max min 聚集函数
create drop alter
insert update delete
grant revoke
create schema __ drop schema __ 创建模式
create table __ drop table __ alter table 创建删除修改表
create view __ drop view 视图
crate index __ drop index 索引
create schema "S-T" authorization Wang
caeate schema authorization Wang
drop schema Wang cascade 无限制删除
cascade cascade cascade
restrict 限制
caeate table student
(Sno char(9) primary key,
Sname char(20) unique,
);
alter table Student add s_entrence date 增加属性列
alter table Student alter column Sage int 改变列的数据类型
alter table Course add unique(Cname) 增加唯一性约束
restrict
create cluster index Stusname on Student(Sname) // 聚簇索引
create unique index Stusno on Student(Sno) //默认升序建立索引
create unique index SCno on SC(Sno asc, Cno desc) //Sno 升序 Cno 降序
drop index Stusno
distinct
创建视图
create view is_student
AS
select sno, sname, sage
from student
where sdept = 'is';
drop table student restrict; //限制删除基本表
creat cluster index stuname on student(sname) 建立聚簇索引
一个基本表只能建立一个聚簇索引,建立索引为了提高查询效率
drop index stuname;
select distinct sno from SC 消除重复的行
降序排列 order by子句
select sno, grade
from SC
where cno = '3'
order by grade desc
count sum avg max min 聚集函数
相关文章推荐
- 黑马程序员--SQL注册漏洞 学习日志
- [置顶] ibatis配置log4j输出sql语句等日志信息
- [置顶] 学习随笔之SQL手工注入的总结
- SQL 学习日志02
- SQL 学习日志03
- 我的成长日志20131124学习SQL
- 学习随笔-处理置顶信息的SQL语句
- [置顶] orm 用多了,忽然发觉SQL不会写了... 整个基本的功能重新学习SQL,改自fleaphp
- [置顶] 学习了一点sql语句
- [置顶] 学习日志
- SQL学习日志-3 not 、 in
- SQL学习日志-2.表名的理解
- SQL学习日志
- sql学习日志
- SQL学习日志-1.数据库的定义
- Entity Framework with MySQL 学习笔记一(查看EF和SQL请求日志)
- SQL学习日志
- SQL学习日志
- SQL学习:mysql数据库备份和使用日志恢复+python调用mysql方法(4)
- SQL 学习日志01