In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Xiaobian to share with you how to achieve data analysis in SQL, I hope you have something to gain after reading this article, let's discuss it together!
SQL is a language, like C++ and Java. Whether it is front-end, back-end or other programming positions, you will understand some, such as basic additions, deletions and changes. In fact, using it is the same as operating data in Excel. Most of the supplementary recording platforms are still using Excel for supplementary recording.
After language, let's talk about databases. Database, as its name implies, is a warehouse for storing data, just like our granary stores grain. What is stored in the database is data. How to store data in the database? Just like excel, it is a table. In the database, it is called TABLE. There are two elements in the table, one is a column and the other is a row. This two-dimensional structure constitutes the table.(name, age, gender) This is called column name, the table also has a table name, this table is called personnel information table (p), in the database, the data is stored in the form of rows and columns like the following table, when we want to open this table, just like opening an excel table to view the data, we need to use a statement:
select * from Personnel Information Table
select Name, Age, Gender from Personnel Information Form
From : Tell the system where the data you want is.
WHERE: Filter each record
SELECT: Defines the column returned (this column can be a column in a table, a constant, or the calculated value of the column)
SELECT * |listing| constant value FROM [pattern name.] Table name;
'*' indicates all columns of the target table in the query
" |" , indicates or relationship, optional
Column to column, separated by commas ','
Each column in each row can have only one value
In this way, we can open the same table, view all the data in the table, here if we only want to see a certain column, or a few columns, in excel we will select the hide button to hide the columns we do not want to see, our SQL statement can select the columns we want to see, written after SELECT, and the table is exactly the opposite.
In table operations, we often use a filtering operation, such as filtering out a list of people with gender 'female'. In the database, we can use the where condition to operate:
select * from Personnel Information Table where Gender ='Female'
Where can be followed by many conditions, using AND OR NOT to connect
and (and): If both condition 1 and condition 2 are satisfied, return true
or (or): If both condition 1 and condition 2 are not satisfied, return false
not: not conditional, negated
Priority: NOT> AND> OR
We can change the priority by parenthesis, and the condition in parenthesis is executed first.
For example, if you want to find someone who is female and older than 18, you can use:
select * from Personnel Information Table where Gender ='Female' AND Age>18
So using the above statement you can do two of the most common operations we use in excel: show the rows you want and show the columns you want to see
After reading this article, I believe you have a certain understanding of "how to achieve data analysis in SQL". If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!
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.