## 1. 创建表 ```sql create table ttt( no int primary key, name char(10) not null, depno int, indate date, sal numeric(8,2) ); // numrtic(a,b): 数字类型,总位数为8,小数点后b位 // char(a): 定长为a的字符串 // varchar(a): 变长字符串,最大长度为a ``` ## 2. 删除表 ```sql drop table ttt; drop table ttt if exists; ``` ## 3. 插入 ```sql insert into ttt values(1,"ttt",1,"2023-05-28",12.33); insert into ttt(no,name,depno,indate,sal) values(1,"ttt",1,"2023-05-28",12.33); insert into ttt(no,name,depno) values(1,"ttt",1); ``` ## 4. distinct去除重复 ```sql selet distinct depno from ttt; ``` ## 5.查询多个值 ```sql select name from ttt where depno in (2,3,5); select name from ttt where depno not in (2,3,5); ``` ## 6. between ```sql select name from ttt where indate between '2022-01-22' and '2023-04-30'; // 等价 select name from ttt where indate>='2022-01-22' and indate<>='2023-04-30'; select name from ttt where indate not between '2022-01-22' and '2023-04-30'; ```