This document contains examples of SQL queries using single-row functions to:
1) Display the current date and format it.
2) Calculate salary increases and differences for employees.
3) Format employee names and calculate name lengths.
4) Concatenate employee names and salaries.
5) Format the system date with specific text.
6) Calculate annual employee compensation amounts.
This document contains examples of SQL queries using single-row functions to:
1) Display the current date and format it.
2) Calculate salary increases and differences for employees.
3) Format employee names and calculate name lengths.
4) Concatenate employee names and salaries.
5) Format the system date with specific text.
6) Calculate annual employee compensation amounts.
This document contains examples of SQL queries using single-row functions to:
1) Display the current date and format it.
2) Calculate salary increases and differences for employees.
3) Format employee names and calculate name lengths.
4) Concatenate employee names and salaries.
5) Format the system date with specific text.
6) Calculate annual employee compensation amounts.
a. Write a query to display the current date. Label the
column Date. Query: SELECT SYSDATE AS "DATE" FROM DUAL;
b. For each employee, display the employee number,
salary, and salary increasedby 15% and expressed as a whole number. Label the column New Salary. Query : SELECT EMP_NO,EMP_NAME,EMP_SAL,EMP_SAL+(EMP_SAL*15/100) "New Salary" FROM EMPLOYEE;
EN.NO. = 196170316005 BAROT JINAY
DM SEM-4(IT) BATCH: A1
c. Modify your above query to add a column that
subtracts the old salary from the new salary. Label the column Increase. Query: SELECT EMP_NO,EMP_NAME,EMP_SAL,EMP_SAL+(EMP_SAL*15/100) "New Salary", (EMP_SAL+(EMP_SAL*15/100))- EMP_SAL "INCREASE" FROM EMPLOYEE;
d. Write a query that displays the employee‟s names
with the first lettercapitalized and all other letters
EN.NO. = 196170316005 BAROT JINAY
DM SEM-4(IT) BATCH: A1
lowercase, and the length of the names, for all
employees whose name starts with J, A, or M. Give each column an appropriate label. Sort the results by the employees‟ names. Query: SELECT INITCAP(EMP_NAME) "Name", LENGTH(EMP_NAME) "Length of Name" FROM EMPLOYEE WHERE EMP_NAME LIKE 'J%' OR EMP_NAME LIKE 'A%' OR EMP_NAME LIKE 'M%' ORDER BY EMP_NAME;
e. Write a query that produces the following for each
Ultimate Snowflake Architecture for Cloud Data Warehousing: Architect, Manage, Secure, and Optimize Your Data Infrastructure Using Snowflake for Actionable Insights and Informed Decisions (English Edition)