Basic SQL commands

Source: Internet
Author: User

1. Rules for using SQL commands
1, each order must be; End
2. SQL command does not distinguish between letter case
3. Use \c to terminate the execution of the current command

2, the management of the library
1, the basic operation of the library
1. View existing libraries
show databases;
2. Create library (specify character set)
Create database library name [character set UTF8];
3. View the statement that created the library (character set)
Show create database name;
4. View your current library
Select Database ();
5. Switch the Library
Use library name;
6. View existing tables in the library
Show tables;
7. Delete Library
drop database name;

2. Naming rules for library names
1, numbers, letters, underscores, but cannot use pure numbers
2, the library name distinguishes the letter case
3. Cannot use special characters and MySQL keyword


3, the management of the table
1, the basic operation of the table
Create TABLE (specify character Set)
CREATE TABLE Table name (
Field name data type,
Field name data type,
...
Field name data type
);
2. View the character set of an existing table
Show create table table name;
3. View table structure
DESC table name;
4. Delete a table
drop table name;

4. Attention
1, all the data are stored in the form of files in the database directory
2. Database directory:/var/lib/mysql

Basic SQL commands

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.