mysql 创建表:
create table user(id int(4) primary key not null auto_increment);
参考
排序:desc为倒序
select * from (select * from contents ORDER BY contenttime DESC) as a where movieid= #{arg0} limit #{arg1} ,#{arg2}
外键:删除时先删除;有外键的表,因为:单表是独立的,如果删除,会影响有外键的表
注意:1对多:外键,1的那一方需要写上外键,
创建department表:
[sql] view plain copy
create table department(
dept_name varchar(20),
budget int,
descript varchar(20),
primary key(dept_name)
);
创建course表:
[sql] view plain copy
create table course(
course_id varchar(20),
deptnames varchar(20),
credits int,
foreign key(deptnames) references department(dept_name));
course表的外键deptnames指向department表的dept_name。
若要删除department,course这两个表,则必须先删除course表,再删除department表。