QueryOK, 0 rowsaffected (0.05sec) modify the table column type: ALTERTABLEorderitemsMODIFYdateDATE; 4. insert (DML): insertintou
Query OK, 0 rows affected (0.05 sec) MODIFY the TABLE column type: ALTER TABLE orderitems MODIFY date DATE; 4. insert (DML): insert into u
1. Create a database:
Create database OrderTicket;
Query OK, 1 row affected (0.00 sec)
2. database used:
Mysql> use OrderTicket;
Database changed
Mysql> show tables;
Empty set (0.00 sec)
Mysql> use OrderTicket;
Database changed
3. Create tables (DDL ):
Mysql> create table orderitems (ID int (8) not null auto_increment, FLIGHT_ID BIGINT
(12), date datetime, primary key (ID ))
Query OK, 0 rows affected (0.05 sec)
Modify the table column type:
Alter table orderitems MODIFY date DATE;
4. insert (DML ):
Insert into users values (004, '004 ', 'home source', 'root', 'M', '000000', 'blues-cen@hotmail.com ');
Query, modify, delete, and so on.
5. Create a foreign key:
Fights is the referenced table, and its ENGINE type is not set before. orderitems is the referenced table.
Referenced table:
1. Use alter table fights ENGINE = INNODB.
See the following table:
1. mysql> create table orderitems (id bigint (20) not null AUTO_INCREMENT, fight_id BIGINT (20) not null, date DATETIME, INDEX (fight_id), primary key (ID ), foreign key (fight_id) REFERENCES fights (ID) on delete cascade on update cascade) engine = innodb;
Query OK, 0 rows affected (0.06 sec)
Pay attention to the details:
(1) do not write the TABLE name as TABEL.
(2) Use copy and paste in the mysql (dos) Program:
Select> right-click the title bar and choose Edit> copy to copy the selected content from the command line to the clipboard.
Paste: copy the text to clipboard and edit the title. paste the text to the current cursor Input Point.
(3) mysql (dos) inserts data at the previous position of the current cursor.
(4) You can use VALUES (1, '***', '***'), (2, '***', '***') for insertion ,'**','***'); insert multiple rows at a time.