摘要: create table dept( id int PRIMARY key auto_increment, dep_name varchar(20), addr varchar(20) ); create table emp( id int PRIMARY key auto_increment, n 阅读全文
posted @ 2024-09-07 22:27 wangyin0425 阅读(57) 评论(0) 推荐(0)
摘要: create table emp( id int PRIMARY KEY AUTO_INCREMENT, ename varchar(50) not null unique, joindate date not null, salary double(7,2) not null, bonus dou 阅读全文
posted @ 2024-09-07 22:11 wangyin0425 阅读(13) 评论(0) 推荐(0)
摘要: 非空约束(NOT NULL):保证列中所有数据不能有null值; 唯一约束(UNIQUE):保证列中所有数据各不相同; 主键约束(PRIMARY KEY):主键是一行数据的唯一标识,要求非空且唯一; 检查约束(CHECK):保证列中的值满足某一条件; 默认约束(DEFAULT):保存数据时,未指定值 阅读全文
posted @ 2024-09-07 19:10 wangyin0425 阅读(20) 评论(0) 推荐(0)
摘要: 1. select * from stu limit 0,3; 2. select * from stu limit 0,3; 3. select * from stu limit 3,3; 4. select * from stu limit 6,3; 阅读全文
posted @ 2024-09-07 18:52 wangyin0425 阅读(14) 评论(0) 推荐(0)
摘要: 1. select sex,avg(math) from stu group by sex; 2. select sex,avg(math),count(*) from stu group by sex; 3. select sex,avg(math),count(*) from stu where 阅读全文
posted @ 2024-09-07 14:46 wangyin0425 阅读(21) 评论(0) 推荐(0)
摘要: 1. select count(*) from stu; 2. select max(math) from stu; 3. select min(math) from stu; 4. select sum(math) from stu; 5. select avg(math) from stu; 6 阅读全文
posted @ 2024-09-07 12:26 wangyin0425 阅读(24) 评论(0) 推荐(0)
摘要: 1. select * from stu where age>20; 2. select * from stu where age>=20; 3. select * from stu where age>=20 and age<=30; 4. select * from stu where hire 阅读全文
posted @ 2024-09-07 12:16 wangyin0425 阅读(23) 评论(0) 推荐(0)
摘要: 1. select * from stu order by age asc; 2. select * from stu order by math desc; 3. select * from stu order by math desc,english asc; 阅读全文
posted @ 2024-09-07 12:12 wangyin0425 阅读(11) 评论(0) 推荐(0)