MySQL learning experience

Source: Internet
Author: User

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 ));

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.