This article mainly introducesMySQL Command LineThe following example shows how MySQL executes the script under the command line. Now let's start to introduce this process.
1. Write an SQL script and save it as book. SQL. The content is as follows::
- Use test;
-
- Create table book
-
- (
-
- Tisbn varchar (20) primary key,
-
- Tbname varchar (100 ),
-
- Tauthor varchar (30 ),
-
- Chubanshe varchar (40 ),
-
- Bookdate date,
-
- Bookpage int,
-
- Leixing varchar (20 ),
-
- Bprice float (6, 2)
-
- );
-
- Insert into book values ('20170101', 'java SE 9787115167408 programming Guide ',
-
- 'Wu Yafeng; JI Chao ',
-
- 'People's post and telecommunications Publishing House ', '2017-11-0', 2007,
-
- 'Computer class', 98.00 );
-
- Insert into book values ('20140901 ',
-
- 'Proficient in Netbeans-Java Desktop, Web and enterprise-level Program Development details ',
-
- 'Wu Yafeng; Wang xinlei ',
-
- 'People's post and telecommunications Publishing House ', '2017-2-10', 2007,
-
- 'Computer class', 75.00 );
-
- Insert into book values ('20140901', 'high quality programming art ',
-
- '(Greece) Diomidis Spinellis ',
-
- 'People's publishing house ', '2017-1-00', 2008,
-
- 'Computer class', 55.00 );
-
- Insert into book values ('20140901', 'java programming ideology (version 9787111213826 )',
-
- '(US) Bruce Eckel ',
-
- 'Machinery Industry Publishing House ', '2017-6-00', 2007,
-
- 'Computer class', 108.00 );
-
- Insert into book values ('20170101', 'struts 2 authoritative Guide ',
-
- 'Li gang', 'electronics Industry Publishing House ', '2017-9-00', 2007,
-
- 'Computer class', 79.00 );
-
- Insert into book values ('20170101', 'javascript authoritative Guide ',
-
- '(US) David Flanagan', 'machinery Industry Publishing House ', '2017-8-00', 2007,
-
- 'Computer class', 109.00 );
-
- Insert into book values ('20170101', 'spring 9787121042621 core technologies and best practices ',
-
- 'Liao Xuefeng ', 'electronics Industry Publishing House', '2017-6-00 ', 2007,
-
- 'Computer class', 59.80 );
-
- Insert into book values ('20170101', 'java and mode ',
-
- 'Macro macro ',
-
- 'Electronics Industry Publishing House ', '2017-10-00', 2002,
-
- 'Computer class', 88.00 );
-
- Insert into book values ('20170101', 'vb 9787302167792 &. NET 2005 advanced programming ',
-
- '(US) Bill Evjen; Billy holis; Bill Sheldon ',
-
- 'Tsinghua University Press ', '2017-2-00', 2008,
-
- 'Computer class', 45.00 );
-
- Insert into book values ('20140901', 'javascript advanced programming Design ',
-
- 'Nicholas C. zakas ',
-
- 'People's post and telecommunications Publishing House ', '2017-11-0', 2006,
-
- 'Computer class', 59.00 );
2. Enter the MySQL Command Line
Method 1: If the database is not connected, enter mysql-h localhost-u root-p 123456 <d: \ book. SQL and press Enter;
Method 2: When the database has been connected, the command prompt is mysql>, enter source d: \ book. SQL or \. d: \ book. SQL and press Enter.
3. The running results of mysql> \. d: \ book. SQL are as follows:
The above is the script execution process in the MySQL command line. If you want to learn more about the MySQL database, read the article here: http://database.51cto.com/mysql/. I hope you can get it!