Build Library:
CREATE DATABASE Database name DEFAULT charset= ' UTF8 ';
Create database j18 defaultcharset= ' utf-8 ';
Create Database j18 The default character encoding Utf-8
Drop Database database name; Delete the specified database
Use commands to enter a specified warehouse
Use warehouse name
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/88/FB/wKiom1gDfCOxEHewAAAFDvfxj7s880.png-wh_500x0-wm_3 -wmp_4-s_3822974964.png "Title=" $S {{GF (NG5HX78P0F@7ITYM.png "alt=" Wkiom1gdfcoxehewaaafdvfxj7s880.png-wh_50 "/>
because we don't know which libraries are in the system, we use the show databases command line to show those libraries;
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/88/FB/wKiom1gDfQOjGoNLAAANln-zNac992.png-wh_500x0-wm_3 -wmp_4-s_2159443490.png "title=" K (p7t8o8jz~a{7t297z_3of.png "alt=" Wkiom1gdfqojgonlaaanln-znac992.png-wh_50 "/>
use commands to see which tables are in the library
Show tables;
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/88/FB/wKiom1gDfUTTWowjAAACg38O71M481.png-wh_500x0-wm_3 -wmp_4-s_2024666227.png "title=" qzqtdaocoivbeq$}527) mwf.png "alt=" Wkiom1gdfuttwowjaaacg38o71m481.png-wh_50 "/>
To view information for a specified table using SQL statements
Structured Query statements
Select * from table name ; See all the information in the table
data type:
integer: TINYINT 1 bytes -128~127, SMALLINT 2 bytes -32768~32767 INT 4 bytes +- billion,BIGINT 8 bytes decimal: FLOAT ,DOUBLE ,decimal (m,n) the number of digits after the decimal point (M,n) m represents the number of digits in this number,n means that there are several after the decimal point (5,2) 123.22 (5,2) 4.1111 string: CHAR (m)--m represents the length of the string that the field can represent, up to 255 VARCHAR (m)--m indicates the length of the field that can be expressed BLOB-- for storing binary large files Time and Date: Date-- represents 1000-1-1 ~ 9999-12-31 Time-- means 00:00:00 ~ 23:59:59 DateTime--1000-1-1 00:00:00 ~9999-12-31 23:59:59 |
to build a table statement:
CREATE TABLE Table name ( field 1 data type constraints , field 2 data type constraints , ... field n data type constraint ); Red Word, is fixed format, do not go to modify Case: Create Table Student ( Sid int PRIMARY KEY, Sname varchar () NOT NULL, Sex char (1), Brithdate Date ) |
This article is from the "12160034" blog, please be sure to keep this source http://12170034.blog.51cto.com/12160034/1862454
MySQL First lesson