create database mydata; use mydata; create table dept ( deptno int primary key, dname varchar(14), loc varchar(13) ); create table emp ( empno int primary key, ename varchar(10), job varchar(10), mgr int, hiredate datetime, sal double, comm double, deptno int, foreign key (deptno) references dept(deptno) ); ? . c:\mysql_script\mydata.sql desc dept insert into dept values(10, 'A', 'a'); insert into dept values(20, 'B', 'b'); insert into dept values(30, 'C', 'c'); insert into dept values(40, 'D', 'd'); insert into dept values(50, 'E', 'e'); commit; select * from dept order by deptno desc limit 3, 2; -- 降序第三行之后,分页 create table article ( id int primary key auto_increment, -- 自动递增 title varchar(255) ); select now(); select date_format(now(), '%Y-%m-%d %H:%i:%s'); insert into emp values(9999, 'test', 'clerk', 7369, '1981-12-23 12:23:23', 8000, 80, 10); -------------------bbs.sql---------------------------------------------------------------------- create database bbs; use bbs; create table article ( id int primary key auto_increment, pid int, rootid int, title varchar(255), cont text, pdate datetime, isleaf int ); insert into article values (null, 0, 1, '蚂蚁大战大象', '蚂蚁大战大象', now(), 1); insert into article values (null, 1, 1, '大象被打趴下了', '大象被打趴下了',now(), 1); insert into article values (null, 2, 1, '蚂蚁也不好过','蚂蚁也不好过', now(), 0); insert into article values (null, 2, 1, '瞎说', '瞎说', now(), 1); insert into article values (null, 4, 1, '没有瞎说', '没有瞎说', now(), 0); insert into article values (null, 1, 1, '怎么可能', '怎么可能', now(), 1); insert into article values (null, 6, 1, '怎么没有可能', '怎么没有可能', now(), 0); insert into article values (null, 6, 1, '可能性是很大的', '可能性是很大的', now(), 0); insert into article values (null, 2, 1, '大象进医院了', '大象进医院了', now(), 1); insert into article values (null, 9, 1, '护士是蚂蚁', '护士是蚂蚁', now(), 0); ---------------------------------------------------------------------------------