MySQL \. Execute the script file mysql> \. c: \ mydata. SQL
Up key can input text previously entered
-- Annotation
Show create table article; view the structure of the article table
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; how many databases are there?
Show tables; how many tables are there?
Desc dept (Table Name); view the table structure
Insert into dept values (10, 'A', 'A ');
Commit
Database difference: Data Type (numeric value, text, date, binary object)
PagingProgram(Three items are displayed on one page ),
Auto increment Field
Select * from Dept order by deptno DESC limit 3, 3; (from the third
Two digits backward)
> Create Table article
> (
> ID int primary key auto_increment,
> Tiele varchar (255)
>); Auto Increment
Select now (); returns the current time
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', 'cler', 7369, '2017-12-1
12:10:10 ', 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 ));