MySQL command line execution. SQL script details

Source: Internet
Author: User

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::

 
 
  1. Use test;
  2.  
  3. Create table book
  4.  
  5. (
  6.  
  7. Tisbn varchar (20) primary key,
  8.  
  9. Tbname varchar (100 ),
  10.  
  11. Tauthor varchar (30 ),
  12.  
  13. Chubanshe varchar (40 ),
  14.  
  15. Bookdate date,
  16.  
  17. Bookpage int,
  18.  
  19. Leixing varchar (20 ),
  20.  
  21. Bprice float (6, 2)
  22.  
  23. );
  24.  
  25. Insert into book values ('20170101', 'java SE 9787115167408 programming Guide ',
  26.  
  27. 'Wu Yafeng; JI Chao ',
  28.  
  29. 'People's post and telecommunications Publishing House ', '2017-11-0', 2007,
  30.  
  31. 'Computer class', 98.00 );
  32.  
  33. Insert into book values ('20140901 ',
  34.  
  35. 'Proficient in Netbeans-Java Desktop, Web and enterprise-level Program Development details ',
  36.  
  37. 'Wu Yafeng; Wang xinlei ',
  38.  
  39. 'People's post and telecommunications Publishing House ', '2017-2-10', 2007,
  40.  
  41. 'Computer class', 75.00 );
  42.  
  43. Insert into book values ('20140901', 'high quality programming art ',
  44.  
  45. '(Greece) Diomidis Spinellis ',
  46.  
  47. 'People's publishing house ', '2017-1-00', 2008,
  48.  
  49. 'Computer class', 55.00 );
  50.  
  51. Insert into book values ('20140901', 'java programming ideology (version 9787111213826 )',
  52.  
  53. '(US) Bruce Eckel ',
  54.  
  55. 'Machinery Industry Publishing House ', '2017-6-00', 2007,
  56.  
  57. 'Computer class', 108.00 );
  58.  
  59. Insert into book values ('20170101', 'struts 2 authoritative Guide ',
  60.  
  61. 'Li gang', 'electronics Industry Publishing House ', '2017-9-00', 2007,
  62.  
  63. 'Computer class', 79.00 );
  64.  
  65. Insert into book values ('20170101', 'javascript authoritative Guide ',
  66.  
  67. '(US) David Flanagan', 'machinery Industry Publishing House ', '2017-8-00', 2007,
  68.  
  69. 'Computer class', 109.00 );
  70.  
  71. Insert into book values ('20170101', 'spring 9787121042621 core technologies and best practices ',
  72.  
  73. 'Liao Xuefeng ', 'electronics Industry Publishing House', '2017-6-00 ', 2007,
  74.  
  75. 'Computer class', 59.80 );
  76.  
  77. Insert into book values ('20170101', 'java and mode ',
  78.  
  79. 'Macro macro ',
  80.  
  81. 'Electronics Industry Publishing House ', '2017-10-00', 2002,
  82.  
  83. 'Computer class', 88.00 );
  84.  
  85. Insert into book values ('20170101', 'vb 9787302167792 &. NET 2005 advanced programming ',
  86.  
  87. '(US) Bill Evjen; Billy holis; Bill Sheldon ',
  88.  
  89. 'Tsinghua University Press ', '2017-2-00', 2008,
  90.  
  91. 'Computer class', 45.00 );
  92.  
  93. Insert into book values ('20140901', 'javascript advanced programming Design ',
  94.  
  95. 'Nicholas C. zakas ',
  96.  
  97. 'People's post and telecommunications Publishing House ', '2017-11-0', 2006,
  98.  
  99. '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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.