日期:2014-05-16 浏览次数:20810 次
?
1--create database mydata7;
ok
?
use mydata7;
successful
?
2--create table dept
(
deptno int primary key,
dname varchar(13),
loc varchar(10)
);
successful;
?
3--create table emp
(
empno int primary key,
?
ename varchar(14),
?
ename varchar(2),
?
job varchar(10),
?
comm double,
?
sal double,
?
deptno int,
?
foreign key(deptno) references dept(deptno)
);
ok
?
查看mysql下有那些表用--show databases/show tables;
?
查看表结构 desc emp
?
插入数据和oracle一样 insert into dept values(1,'liuwenwne','2');
?
3--mysql分页
select * from dept order by deptno desc limit 3,2;(从第三条开始往后数2条)。
?
4--mysql自动递增、
create table article
(
?id int primary key auto_increment,
?titile varchar(10),
);
?
insert into article values(null,'a');
ok
?
insert into article (title) values('c');
id??? title
1????? a
2????? c(注意这里自动添加一个数字2)。这就是mysql的自动递增
?
?
mysql日期 select now();