一、数据库创建:creat database school;
二、数据库删除:drop database school;
三、数据库类型:
1. 时间:年月日(date), 时分秒(time), 年月日时分秒(datetime),时间戳(timestamp)
2. 数 :整数(tiny或small或medium或big+int)、小数(float或duble)、定点数(numeric(3,1):44.5)
3.字符串 :(var)char、(tiny/medium/long)blob、(tiny/medium/long)text
四、创建表:create table if not exists sc(
'sno' varchar(6) not null,
'cno' varchar(3) not null,
'grade' int(11) default null,
primary key(sn,cno),
foreign key(sno) references student,
foreign key(cno)references course);
五、删除表:drop table sc;
六、往表插入数据:insert into sc (sno,cno,grade) values(201502,304,90);
七、查询数据:select distinct...form...where...
八。 更新数据:update sc set grade=30 where sno='201502';
九、删除行:delet from table where...
十、like 模糊搜索:把=换成like即可,select * form sc where 'sno' llike '%15%';
十一、排序:order by 属性;升序ASC、降序DESC
十二、分组:group by 属性;
十三、连接:table_A left join/inner join/right join table_B on 属性;
十四、删除/插入列:alter table sc drop/add 'sno';