In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the method of SQL query". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
What is a database?
When using SQL language for data analysis, data merging, data grouping, data deduplication and so on are often used, all of which are completed by query. Therefore, data query is the core operation of the database, and there is a query command in SQL query language, that is, SELECT statement.
SELECT statement is the core language of SQL, which can complete the powerful query function and query the desired data from the database according to the specified conditional rules. The basic syntax of the SELECT statement is: SELECT field 1, field 2, field 3, … FROM table WHERE conditional SELECT statement is used to select the fields used for our data analysis from the table, and the WHERE statement is used to add filter conditions, which is similar to getting the filtering function in EXCEL. After understanding the basic rules for the use of statements, we give an example to illustrate how the SQL statement is applied. If winter comes, can spring be far behind?
It's time for the annual family to get married again.
Sister Chen, she is also very upset.
So, from what I know about her,
Wrote the following SQL statement
Help Sister Chen to match the other half accurately.
SELECT name, sex, city, age, height, housing, car, marital status, education background, monthly income, personality FROM national single youth address book WHERE gender = 'male' AND city = 'Luoyang' AND age BETWEEN (28Co29) AND height BETWEEN (170180) whether AND has a house = 'yes' AND has a car = 'yes' AND marital status = 'unmarried' AND education background IN ('undergraduate') AND monthly income > = 10000AND character IN ('gentle', 'considerate', 'generous') ORDER BY monthly income DESC
Let's interpret the above requirements. First, we select the national address book for single youth, which contains key fields such as name, gender, and city, and then add screening conditions. The gender is male, the family lives in Luoyang, and the age is between 28 and 29 years old. Height is between 170 and 180, car and house are unmarried, education background is undergraduate or graduate student, monthly income is not less than 10,000 yuan, gentle, considerate and generous. Finally, the selected list is sorted according to the descending order of monthly income, through the SQL sentence to help Sister Chen meet Xianliang as soon as possible.
The above sentence is easy to understand, here is a description of the matters needing attention in the SQL statement.
In SQL statements, uppercase or lowercase letters can be used.
The keywords of each SQL statement are separated by space symbols
Separate fields or parameters with commas
If the parameter in the SQL statement is character type, you need to use single quotation marks, but numeric ones do not use single quotation marks.
At the end of the SQL statement, add a semicolon at the end of the statement
SQL statements that contain special characters in field names need to be enclosed in square brackets "[]" to avoid incorrect results or SQL statements that cannot be run.
The representative in the SQL statement selects all fields in the selected table and sorts them according to their specific order in the database.
The comma, semicolon, single quotation mark, parenthesis and other symbols used in SQL statements are all entered in English. This is the end of the content of "what is the query method of SQL statement". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.