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