In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Column aliases are mainly used when the name is too long or when a SQL statement is too long and column names are used repeatedly
1. Column alias:
Rename a column header
easy to calculate
Following column names (you can also insert the keyword 'AS' between column names and aliases).
Double quotes are required if it contains spaces or special characters, or if it is case-sensitive
For example: last_name becomes name, commission_pct becomes comm
select last_name as name, commission_pct comm from employees;
Here's a test. It seems that AS can also be written as
2. Find the person with the highest salary in the first_name quarter and arrange them in ascending order.
select first_name "Name", salary*3 "Quarter salary" from employees order by "Quarter salary";
3. Use join operators, literal strings, reference operators, DISTINCT keywords and DESCRIBE command
First of all, distinct means to remove weight
II. Connector:
Connect columns to columns and columns to characters. use '||'indicates. Can be used to 'synthesize' columns.
Combine the first name and job_id together. (where SA_REP is job_id information)
select first_name||job_id from employees;
Sharp-eyed people may have seen the information in the column above showing how it became FIRST_NAME|| JOB_ID, yes oracle default is to search the column to display. So let's use alias processing
select lfirst_name||job_id as emp from employees;
For example, if you want to output "How much is everyone's annual salary?"
select last_name || q'['s ANN salary is: ]' || salary*12 as emp_ann_salary from employees;
For example, how to output "What is the department ID of each person"
select last_name || q'['s Department ID is ]' || department_id as dep_id from employees;
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.