The MySQL command line executes. SQL script in a detailed

Source: Internet
Author: User
Tags mysql command line java se

This article introduces an example of executing a script file at the mysql command line , which lets us see how MySQL executes the script at the command line. Now let's start by introducing this process.

1. First write SQL script, save as: Book.sql, the content is as follows :

1 Use test; 2      3 CREATE TABLE Book4      5     (   6      7TISBN varchar (20) primary KEY,8      9Tbname varchar (100),   Ten       OneTauthor varchar (30),    A       -Chubanshe varchar (40),    -       the bookdate Date, -       -BookPageint,    -       +leixing varchar (20),    -       +Bpricefloat(6,2)    A       at     );  -       -Insert into book values (' 9787115167408 ', ' JAVA SE 6.0 Programming Guide ',    -       -' Wuya; Guixua ',    -       in' People's post and Telecommunications press ', ' 2007-11-00 ', 874,    -       to' Computer class ', 98.00 );  +       -Insert into book values (' 7115138378 ',    the       *' Proficient in Netbeans--java desktop, Web and enterprise-level program development ',    $      Panax Notoginseng' Wuya; Wang Xin Lei ',    -       the' People's post and Telecommunications press ', ' 2007-2-10 ', 587,    +       A' Computer class ', 75.00 );  the       +Insert into book values (' 9787115167934 ', ' High quality program design art ',    -       $' (Greece) Diomidis Spinellis ',    $       -' The publishing house ', ' 2008-1-00 ', 384,    -       the' Computer class ', 55.00 );  -      WuyiInsert into book values (' 9787111213826 ', ' Java Programming Ideas (4th edition) ',    the       -' (US) Bruce Eckel ',    Wu       -' Mechanical industry Press ', ' 2007-6-00 ', 880,    About       $' Computer class ', 108.00 );  -       -Insert into book values (' 9787121048531 ', ' Struts 2 authoritative guide ',    -       A' Li Gang ', ' Electronics Press ', ' 2007-9-00 ', 715,    +       the' Computer class ', 79.00 );  -       $Insert into book values (' 9787111216322 ', ' JavaScript authoritative guide ',    the       the' (US) David Flanagan ', ' mechanical industry press ', ' 2007-8-00 ', 954,    the       the' Computer class ', 109.00 );  -       inInsert into book values (' 9787121042621 ', ' Spring 2.0 core technology and best practices ',    the       the' Xuefeng Liao ', ' electronic industry Press ', ' 2007-6-00 ', 509,    About       the' Computer class ', 59.80 );  the       theInsert into book values (' 7505380001 ', ' Java and Patterns ',    +       -' Shanhong ',    the      Bayi' Electronics Press ', ' 2002-10-00 ', 1024,    the       the' Computer class ', 88.00 );  -       -Insert into book values (' 9787302167792 ', ' VB 2005 &. NET 3.0 Advanced Programming ',    the       the' (US) Bill Evjen; Billy Hollis; Bill Sheldon ',    the       the' Tsinghua University Press ', ' 2008-2-00 ', 348,    -       the' Computer class ', 45.00 );  the       theInsert into book values (' 7115152098 ', ' JavaScript advanced programming ',   94       the' Nicholas C.zakas ',    the       the' People's post and Telecommunications press ', ' 2006-11-00 ', 532,   98       About' Computer class ', 59.00);

2. Go to MySQL command line

The first way: in the case of not connected to the database, enter mysql-h localhost-u root-p 123456 < d:\book.sql carriage return;

The second way: in the case of a connected database, at which point the command prompt is Mysql>, enter source D:\book.sql or \. D:\book.sql Enter.

3. The following is the use of mysql>\. Results of D:\book.sql Operation:

The above is the MySQL command line execution of the process of scripting, if you want to learn more MySQL database knowledge, may wish to look at the article here: Zhangxichao, hope to bring you the harvest!

The MySQL command line executes. SQL script in a detailed

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.