mysql \. 執行指令檔 mysql> \. C:\\mydata.sql
向上鍵 能輸入以前輸入過的文字
--為注釋
show create table article; 看 article表的結構
article | CREATE TABLE `article` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pid` int(11) DEFAULT NULL, `rootid` int(11) DEFAULT NULL `title` varchar(255) DEFAULT NULL, `cont` text, `pdate` datetime DEFAULT NULL, `isleaf` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=gb2312 |
show databases; 看有多少資料庫
show tables; 看有多少表
desc dept(表名); 看錶的結構
insert into dept values(10,'A','A');
commit
資料庫區別: 資料類型(數值,文本,日期,二進位對象)
分頁程式(一頁顯示三條),
自動遞增欄位
分頁 select * from dept order by deptno desc limit 3, 3;(從第三條
向後數兩條)
> create table article
> (
> id int primary key auto_increment,
> tiele varchar (255)
> ); 自動遞增
select now(); 取目前時間
select date_format(now(),'%Y-%m-%d %h-%i-%s');
select date_format(now(),'%Y-%m-%d %s-%i-%h');
select date_format(now(),'%Y-%m-%d %h-%i-%h');
insert into emp values (9999,'test','clerk',7369,'1981-12-1
12:10:10', 8000,20,10);
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)); create table dept ( deptno int primary key, dname varchar(14), loc varchar(13) );