MySQL practicing insert data in the table

| - demand explanation

Adding data to the curriculum, it requires the use of an insert statement to achieve

 

| - realization of ideas

If you use one sentence, that is, once inserted into the multiple values, MySQL syntax is:

INSERT  INTO table name  [( list of field names )] values ( value list ), ( value list ), .... ( value list );

 

| - Content Code

# Job using INSERT INTO add data to a curriculum
 use MySchool; # switching database
 Create  Table `timeTable` ( 
  ` course number ` int ( . 4 ) Primary  Key AUTO_INCREMENT, 
    ` course name ` VARCHAR ( 20 is ) Not  null , 
    ` `the number of hours int ( 5 ) not  null , 
    `semester number` int ( 3 ) not  null 
    ) charset = utf8; # create a table 
    
INSERT  INTO`timeTable` (` `course number, course name` `,` `a few hours,` No. semester ') values ( default , ' LogicJava ' , 220 , 1 ), ( default , ' HTML ' , 160 , 1 ), ( default , ' JavaOOP ' , 230 , 2 ); # add data
An INSERT statement to insert more information

 

| - operating results

 

Guess you like

Origin www.cnblogs.com/twuxian/p/11353594.html