SQL Database Learning Notes

Source: Internet
Author: User

Although learning slowly, but also need a step-by-step study.


Study notes:


1. SQL statement is not case sensitive
2. MySQL requires a semicolon;
3. Used commands:
show databases;//shows how many databases are created database First_lesson;//Create a database using First_lesson;//Use this database to show tables;// Shows how many tables describe person;//display the contents of the header in a table
Insert into who values ("DFD", "D", "1990-1-1", "China"); Inserting data
Display the contents of the table SELECT * FROM table_name;
Create a table MyTable (name varchar), sex char (1), birth date,address varchar (20));
4.varchar (20) can be changed by 0-20 characters
5.SQL to be listed as unit
6.distinct repeat removal, show only once;
7. Where is the condition selection select * from the person where name= ' Rocky ';
Use of quotation marks

Note that we use single quotes around the condition values in the example


The and and or operators are used to filter records based on more than one condition.

And and OR operators

And and or can combine two or more conditions in a where sub-statement.

If both the first condition and the second condition are true, the AND operator displays a record.

If only one of the first and second conditions is true, the OR operator displays a record.


ORDER by statement

The order BY statement is used to sort the result set based on the specified column.

The order BY statement sorts records by default in ascending order.

If you want to sort records in descending order, you can use the DESC keyword.


SQL Database Learning Notes

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.