MindMap Gallery MySQL_02 basic SELECT statement
This mind map helps learners master the basic knowledge of SQL, including classification, basic rules, upper and lower case specifications, and how to use SELECT statements to conduct basic data queries. 🔥 SQL Wonderful Adventure, Turn on Data Magic! 🔥
Edited at 2025-03-10 13:59:20Rumi: 10 dimensions of spiritual awakening. When you stop looking for yourself, you will find the entire universe because what you are looking for is also looking for you. Anything you do persevere every day can open a door to the depths of your spirit. In silence, I slipped into the secret realm, and I enjoyed everything to observe the magic around me, and didn't make any noise. Why do you like to crawl when you are born with wings? The soul has its own ears and can hear things that the mind cannot understand. Seek inward for the answer to everything, everything in the universe is in you. Lovers do not end up meeting somewhere, and there is no parting in this world. A wound is where light enters your heart.
Chronic heart failure is not just a problem of the speed of heart rate! It is caused by the decrease in myocardial contraction and diastolic function, which leads to insufficient cardiac output, which in turn causes congestion in the pulmonary circulation and congestion in the systemic circulation. From causes, inducement to compensation mechanisms, the pathophysiological processes of heart failure are complex and diverse. By controlling edema, reducing the heart's front and afterload, improving cardiac comfort function, and preventing and treating basic causes, we can effectively respond to this challenge. Only by understanding the mechanisms and clinical manifestations of heart failure and mastering prevention and treatment strategies can we better protect heart health.
Ischemia-reperfusion injury is a phenomenon that cellular function and metabolic disorders and structural damage will worsen after organs or tissues restore blood supply. Its main mechanisms include increased free radical generation, calcium overload, and the role of microvascular and leukocytes. The heart and brain are common damaged organs, manifested as changes in myocardial metabolism and ultrastructural changes, decreased cardiac function, etc. Prevention and control measures include removing free radicals, reducing calcium overload, improving metabolism and controlling reperfusion conditions, such as low sodium, low temperature, low pressure, etc. Understanding these mechanisms can help develop effective treatment options and alleviate ischemic injury.
Rumi: 10 dimensions of spiritual awakening. When you stop looking for yourself, you will find the entire universe because what you are looking for is also looking for you. Anything you do persevere every day can open a door to the depths of your spirit. In silence, I slipped into the secret realm, and I enjoyed everything to observe the magic around me, and didn't make any noise. Why do you like to crawl when you are born with wings? The soul has its own ears and can hear things that the mind cannot understand. Seek inward for the answer to everything, everything in the universe is in you. Lovers do not end up meeting somewhere, and there is no parting in this world. A wound is where light enters your heart.
Chronic heart failure is not just a problem of the speed of heart rate! It is caused by the decrease in myocardial contraction and diastolic function, which leads to insufficient cardiac output, which in turn causes congestion in the pulmonary circulation and congestion in the systemic circulation. From causes, inducement to compensation mechanisms, the pathophysiological processes of heart failure are complex and diverse. By controlling edema, reducing the heart's front and afterload, improving cardiac comfort function, and preventing and treating basic causes, we can effectively respond to this challenge. Only by understanding the mechanisms and clinical manifestations of heart failure and mastering prevention and treatment strategies can we better protect heart health.
Ischemia-reperfusion injury is a phenomenon that cellular function and metabolic disorders and structural damage will worsen after organs or tissues restore blood supply. Its main mechanisms include increased free radical generation, calcium overload, and the role of microvascular and leukocytes. The heart and brain are common damaged organs, manifested as changes in myocardial metabolism and ultrastructural changes, decreased cardiac function, etc. Prevention and control measures include removing free radicals, reducing calcium overload, improving metabolism and controlling reperfusion conditions, such as low sodium, low temperature, low pressure, etc. Understanding these mechanisms can help develop effective treatment options and alleviate ischemic injury.
Chapter 02_Basic SELECT statement
1. SQL classification
DDL (data definition language), which defines different database objects such as databases, tables, views, indexes, etc., and can also be used to create, delete, and modify the structure of databases and data tables; the main statement keywords are CREATE, DROP, and ALTER.
DML (data operation language), used to add, delete, update and query database records, and check data integrity; the main statement keywords are INSERT, DELETE, UPDATE, and SELECT.
DCL (Data Control Language), used to define databases, tables, fields, users' access rights and security levels; the main statement keywords are GRANT, REVOKE, COMMIT, ROLLBACK, SAVEPOINT.
Note: Because query statements are used very frequently, many people will pick them out as DQL (data query language); and also take COMMIT and ROLLBACK out separately called TCL (transaction control language).
2. Rules and specifications of SQL language
2.1 Basic Rules
SQL can be written on one or more lines. In order to improve readability, each clause is written in sections and indentation is used if necessary.
Each command ends with ; or \g or \G, the latter two are available when executing the command line in the terminal.
Keywords cannot be abbreviated or branched.
About punctuation
It is necessary to ensure that all (), single and double quotes end in pairs.
The half-width input method must be used in English.
String and datetime data can be represented in single quotes ('').
The alias of the column should be indicated in double quotes (" ") as much as possible, and it is not recommended to omit as.
2.2 SQL case specification (recommended to comply with)
MySQL is case-insensitive in Windows environment.
MySQL is case sensitive in Linux environment
Database names, table names, table aliases, and variable names are strictly case-sensitive.
Keywords, function names, column names (or field names), column alias (alias of fields) are case-free.
It is recommended to adopt a unified writing standard
Database name, table name, table alias, field name, field alias, etc. are all lowercase.
SQL keywords, function names, binding variables, etc. are all capitalized.
2.3 Comments
Single-line comment: #Comment text (a unique way of MySQL).
Single line comments: -- Comment text (--must contain a space afterward).
Multi-line comment:/
Comment text /.
2.4 Naming Rules (Temporarily Understand)
Database and table names must not exceed 30 characters, and the variable names are limited to 29.
It must contain only A-Z, a-z, 0-9, _ in total 63 characters.
Do not include spaces in the database name, table name, field name, etc.
In the same MySQL software, the database cannot have the same name; in the same library, the table cannot be duplicated; in the same table, the fields cannot be duplicated.
It is necessary to ensure that the fields do not conflict with reserved words, database systems, or common methods.
Keep the consistency of field names and types, and be sure to maintain consistency when naming fields and specifying data types for them. If the data type is an integer in one table, then it should not become a character type in another table.
2.5 Data import instruction
Log in to mysql on the command line client and import it using the full pathname directive of the source file.
Tools based on specific graphical interfaces.
3. Basic SELECT statements
3.0 SELECT...
3.1 SELECT ... FROM
grammar
Select All Columns
> Generally speaking, unless you need to use all the field data in the table, it is best not to use wildcard characters'
’. > > In production environments, SELECT is not recommended for querying.
Select a specific column
3.2 Column alias
Rename a column, add the keyword AS between the column name and the alias. AS can be omitted, and aliases can be double quoted to include spaces or special characters in the alias and are case sensitive.
3.3 Remove duplicate rows
DISTINCT needs to be placed in front of all column names, otherwise an error will be reported.
DISTINCT is to deduplicate all subsequent column names.
3.4 Null value participates in operation
All operators or column values encounter null values, and the operation result is null.
Note that in MySQL, null values are not equal to empty strings. The length of an empty string is 0, and the length of an empty value is null. MySQL hollow values take up space.
3.5 Focus on number
When the field name or table name and reserved characters and keywords are duplicated, emphasis signs (``, reverse single quotes) should be added to indicate that they are field names or table names, rather than reserved characters and keywords.
3.6 Query constants
4. Display table structure
Use the DESCRIBE or DESC command to represent the table structure.
5. Filter data
Use the WHERE clause to filter out rows that do not meet the conditions.
The WHERE statement follows the FROM clause.