In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Which tables do scott users have?
SQL > select * from tab
Query all rows and columns in the table
SQL > select * from dept
SQL > select * from emp
Save the buffer command as a script:
SQL > save 1.sql
View the contents of the script file:
SQL > get 1.sql
Run the script file:
SQL > @ 1.sql
Query the columns of interest in the table
Select ename,sal from emp
Four operations are used in query
Select ename,sal*12 from emp
Select ename,comm,sal+comm from emp
Null value (null): undefined value, uncertain value, neither zero nor space!
Null values can not directly participate in the four operations!
Name the column aliases in the query
Select ename,sal*12 as annual_salary from emp
-- as is an optional keyword that can be omitted
Select ename,sal*12 annual_salary from emp
Use special characters in aliases, and aliases should be double quoted
Select ename,sal*12 "annual salary" from emp
Join operator: combines multiple columns into one column output
Select ename,job from emp
Select ename | |'is a'| | job from emp
Compress duplicate value
Select deptno from emp
Select distinct deptno from emp
Describe the table structure
Desc emp
Exercise 1
Chapter 1 basic select statement:
1. Make a query to display all the data in the dept table
two。 Make a query to display several ename,job,sal columns in the emp table, in which the sal column is displayed as salary in the result set.
3. Make a query to display the deptno,ename, annual salary in the emp table, and alias the annual salary annual salary
4. Get the structure of the emp table
5. Make a query that displays the employee number, employee name, job, hire date in the emp table, and save the query as a script, script name p1q7.sql
6. Run p1q7.sql
7. Create a query to display the department number in the employee table, and the duplicate department number is displayed only once
8. In the result set, employee names and work connections are separated by "spaces comma spaces" and column headers are displayed as Employee and Title
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.