From the command line to enter some of the most basic database operations

1, first open the command line cmd

2, open the page, enter the command: mysql -u root -p and then hit enter

3, enter their own password database

 

 

 

4, view the database command: show databases;

 

 

Command to create the database: create database + the name of the database to be created

 

5, using a table of commands: use + table name;

 

 6, to see what are the command library table: show tables;

 

 7, command to view the table structure: describe + table name;

 

 8, view the table of contents inside the command: select * from + table name;

 

 9, create a table of command: 

CREATE  TABLE  student (id  INT(10)  NOT NULL UNIQUE  PRIMARY KEY  ,name VARCHAR(20)  NOT NULL ,sex  VARCHAR(4)  ,birth  YEAR,department VARCHAR(20) ,address  VARCHAR(50));

10, which is inserted in the table of contents command: insert into student values ​​(902, 'two Zhanglao', 'M', 1986, 'Chinese Department', 'region Changping');

 

 11, remove a piece of information recorded inside the table: delete from table name of the table where id = id;

 

 12, a data table inside modification: update table set field name = 'new content' + where conditions;

 

 13, the command to delete tables: drop table + table name;

 

 14, the command to delete the database: drop database + database name;

 

Guess you like

Origin www.cnblogs.com/python-django-spid/p/11641830.html