SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Human Resources (HR)
This is the schema that is used in this course. In the Human Resource (HR) records, each employee
has an identification number, email address, job identification code, salary, and manager. Some
employees earn commissions in addition to their salary.
The company also tracks information about jobs within the organization. Each job has an
identification code, job title, and a minimum and maximum salary range for the job. Some
employees have been with the company for a long time and have held different positions within the
company. When an employee resigns, the duration the employee was working for, the job
identification number, and the department are recorded.
The sample company is regionally diverse, so it tracks the locations of its warehouses and
departments. Each employee is assigned to a department, and each department is identified either
by a unique department number or a short name. Each department is associated with one location,
and each location has a full address that includes the street name, postal code, city, state or
province, and the country code.
In places where the departments and warehouses are located, the company records details such as
the country name, currency symbol, currency name, and the region where the country is located
geographically.
HR Schema:

COUNTRIES
DEPARTMENTS
EMPLOYEES
JOB_GRADES
JOB_HISTORY
JOBS
LOCATIONS
REGIONS

Task:

1)
Write a query that displays the last name (with the first letter in uppercase and all the other letters in
lowercase) and the length of the last name for all employees whose name starts with the letters “J,”
“A,” or “M.” (Use Employees table)

2)
Write a query which will print the employees last_name, no.of months worked till date and their
manager name.
Label the columns with the following: Employee – Experience in months – Manager Id

3)
Create a query that displays the first eight characters of the employees’ last names and indicates the
amounts of their salaries with asterisks. Each asterisk signifies a thousand dollars. Sort the data in
descending order of salary. Label the column EMPLOYEES_AND_THEIR_SALARIES.




4)
Create a query to display the last name and the number of weeks employed for all
employees in department 90. Label the number of weeks column TENURE. Truncate
the number of weeks value to 0 decimal places. Show the records in descending order
of the employee’s tenure.
5)
Display each employee’s last name, hire date, and salary review date, which is the first Monday after
six months of service. Label the column REVIEW. Format the dates to appear in the format similar to
“Monday, the Thirty-First of July, 2000.”




6)
Create a report to display the manager number and the salary of the lowest-paid
employee for that manager. Exclude anyone whose manager is not known. Exclude
any groups where the minimum salary is $6,000 or less. Sort the output in descending
order of salary.




7)
Create a query to display the total number of employees and, of that total, the number
of employees hired in 1995, 1996, 1997, and 1998. Create appropriate column
headings.




8)
Create a matrix query to display the job, the salary for that job based on department
number, and the total salary for that job, for departments 20, 50, 80, and 90, giving
each column an appropriate heading.
9)
Create a query that displays the employee last name, job title, department name, salary, and grade for
all employees. (Tables to be used Employees, Departments, Jobs)

10)
Write a query to find the names and hire dates of all the employees who were hired before their
managers, along with their managers’ names and hire dates.




11)
Write a query that displays the employee number and last name of all employees who
work in a department with any employee whose last name contains the letter “u.”
12)
Create a table MY_EMPLOYEE which is a replicate of 'EMPLOYEES' table with all the data.

13)
Add a new column USER_ID to MY_EMPLOYEE table and enforce a unique constraint.

14)
Update the USER_ID column of MY_EMPLOYEE table with the following format.
user_id should contain first letter of the last_name concatenated with first_name of the employee and
the maximum length of the user_id should be 8.

15)
Change the salary to $1,000 for all employees who have a salary less than $900 in MY_EMPLOYEE
table.

16)
Create a view named DEPT50 that contains the employee numbers, employee last names, and
department numbers for all employees in department 50. Label the view columns EMPNO, EMPLOYEE,
and DEPTNO. For security purposes, do not allow an employee to be reassigned to another department
through the view.

17)
Show all employees who were hired on the day of the week on which the highest number of employees
were hired.

18)
Write a query to get the nth highest salary among the employees.
Query should accept a value for n.
If n = 2, then it should retrieve all the employee names who are earning 2nd highest salary among the
employees.

19)
Suppose the primary key constraint has been disabled on employee_id column and users have entered
duplicate employee_id's within the employee table.
Write a query to remove the duplicate rows from the table and preserve the original employee_id which
was existing.

Weitere ähnliche Inhalte

Was ist angesagt?

Top 40 sql queries for testers
Top 40 sql queries for testersTop 40 sql queries for testers
Top 40 sql queries for testerstlvd
 
80 different SQL Queries with output
80 different SQL Queries with output80 different SQL Queries with output
80 different SQL Queries with outputNexus
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questionsPyadav010186
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answersMichael Belete
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functionsNitesh Singh
 
DBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesDBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesMohammad Imam Hossain
 
SQL BUILT-IN FUNCTION
SQL BUILT-IN FUNCTIONSQL BUILT-IN FUNCTION
SQL BUILT-IN FUNCTIONArun Sial
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answersvijaybusu
 
DDL And DML
DDL And DMLDDL And DML
DDL And DMLpnp @in
 
Plsql task
Plsql taskPlsql task
Plsql taskNawaz Sk
 
Complex queries in sql
Complex queries in sqlComplex queries in sql
Complex queries in sqlCharan Reddy
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3Mohd Tousif
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handoutsjhe04
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL CommandsShrija Madhu
 

Was ist angesagt? (20)

Top 40 sql queries for testers
Top 40 sql queries for testersTop 40 sql queries for testers
Top 40 sql queries for testers
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
80 different SQL Queries with output
80 different SQL Queries with output80 different SQL Queries with output
80 different SQL Queries with output
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answers
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
 
Sql query [select, sub] 4
Sql query [select, sub] 4Sql query [select, sub] 4
Sql query [select, sub] 4
 
DBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesDBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related Queries
 
Q on subquery
Q on subqueryQ on subquery
Q on subquery
 
SQL BUILT-IN FUNCTION
SQL BUILT-IN FUNCTIONSQL BUILT-IN FUNCTION
SQL BUILT-IN FUNCTION
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
Dump Answers
Dump AnswersDump Answers
Dump Answers
 
Plsql task
Plsql taskPlsql task
Plsql task
 
Complex queries in sql
Complex queries in sqlComplex queries in sql
Complex queries in sql
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 

Ähnlich wie Sql task

Sql task answers
Sql task answersSql task answers
Sql task answersNawaz Sk
 
Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Mohd Tousif
 
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole CollegeDivyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole Collegedezyneecole
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015dezyneecole
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxhoney690131
 
You are required to develop a simple database application fo.pdf
You are required to develop a simple database application fo.pdfYou are required to develop a simple database application fo.pdf
You are required to develop a simple database application fo.pdfabhishek80801
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set Mohd Tousif
 
Add a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxAdd a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxwviola
 
Nikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd YearNikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd Yeardezyneecole
 
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to Know
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to KnowWhat’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to Know
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to KnowEmtec Inc.
 
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfoliocolbydaman
 
_MITRA PAYROLL Final ppt..pdf
_MITRA PAYROLL  Final ppt..pdf_MITRA PAYROLL  Final ppt..pdf
_MITRA PAYROLL Final ppt..pdfMitra Solutions
 
Sql Portfolio(March 31)
Sql Portfolio(March 31)Sql Portfolio(March 31)
Sql Portfolio(March 31)iceolated
 
AimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxAimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxsimonlbentley59018
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answersNawaz Sk
 
SAP HR Training in Chennai Demo Part-3
SAP HR Training in Chennai Demo Part-3SAP HR Training in Chennai Demo Part-3
SAP HR Training in Chennai Demo Part-3Thecreating Experts
 

Ähnlich wie Sql task (20)

Sql task answers
Sql task answersSql task answers
Sql task answers
 
Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1
 
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole CollegeDivyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
 
Db
DbDb
Db
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
 
You are required to develop a simple database application fo.pdf
You are required to develop a simple database application fo.pdfYou are required to develop a simple database application fo.pdf
You are required to develop a simple database application fo.pdf
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set
 
Add a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxAdd a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docx
 
Nikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd YearNikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd Year
 
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to Know
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to KnowWhat’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to Know
What’s New in HR Analytics from 7.9.6.4 to 11.1.1.x and What You Need to Know
 
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfolio
 
Hr erpnext
Hr erpnextHr erpnext
Hr erpnext
 
_MITRA PAYROLL Final ppt..pdf
_MITRA PAYROLL  Final ppt..pdf_MITRA PAYROLL  Final ppt..pdf
_MITRA PAYROLL Final ppt..pdf
 
Access practicals 2015
Access practicals 2015Access practicals 2015
Access practicals 2015
 
Sql Portfolio(March 31)
Sql Portfolio(March 31)Sql Portfolio(March 31)
Sql Portfolio(March 31)
 
AimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxAimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docx
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 
SAP HR Training in Chennai Demo Part-3
SAP HR Training in Chennai Demo Part-3SAP HR Training in Chennai Demo Part-3
SAP HR Training in Chennai Demo Part-3
 
Vijay Kumar
Vijay KumarVijay Kumar
Vijay Kumar
 

Mehr von Nawaz Sk

Oracle order management implementation manual
Oracle order management implementation manualOracle order management implementation manual
Oracle order management implementation manualNawaz Sk
 
Forall & bulk binds
Forall & bulk bindsForall & bulk binds
Forall & bulk bindsNawaz Sk
 
R12 Shipping Execution User guide
R12 Shipping Execution User guideR12 Shipping Execution User guide
R12 Shipping Execution User guideNawaz Sk
 

Mehr von Nawaz Sk (6)

Tables
TablesTables
Tables
 
Oracle order management implementation manual
Oracle order management implementation manualOracle order management implementation manual
Oracle order management implementation manual
 
Forall & bulk binds
Forall & bulk bindsForall & bulk binds
Forall & bulk binds
 
R12 Shipping Execution User guide
R12 Shipping Execution User guideR12 Shipping Execution User guide
R12 Shipping Execution User guide
 
121poug
121poug121poug
121poug
 
121ontapi
121ontapi121ontapi
121ontapi
 

Kürzlich hochgeladen

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 

Kürzlich hochgeladen (20)

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 

Sql task

  • 1. Human Resources (HR) This is the schema that is used in this course. In the Human Resource (HR) records, each employee has an identification number, email address, job identification code, salary, and manager. Some employees earn commissions in addition to their salary. The company also tracks information about jobs within the organization. Each job has an identification code, job title, and a minimum and maximum salary range for the job. Some employees have been with the company for a long time and have held different positions within the company. When an employee resigns, the duration the employee was working for, the job identification number, and the department are recorded. The sample company is regionally diverse, so it tracks the locations of its warehouses and departments. Each employee is assigned to a department, and each department is identified either by a unique department number or a short name. Each department is associated with one location, and each location has a full address that includes the street name, postal code, city, state or province, and the country code. In places where the departments and warehouses are located, the company records details such as the country name, currency symbol, currency name, and the region where the country is located geographically.
  • 2. HR Schema: COUNTRIES DEPARTMENTS EMPLOYEES JOB_GRADES JOB_HISTORY JOBS LOCATIONS REGIONS Task: 1) Write a query that displays the last name (with the first letter in uppercase and all the other letters in lowercase) and the length of the last name for all employees whose name starts with the letters “J,” “A,” or “M.” (Use Employees table) 2) Write a query which will print the employees last_name, no.of months worked till date and their manager name. Label the columns with the following: Employee – Experience in months – Manager Id 3) Create a query that displays the first eight characters of the employees’ last names and indicates the amounts of their salaries with asterisks. Each asterisk signifies a thousand dollars. Sort the data in descending order of salary. Label the column EMPLOYEES_AND_THEIR_SALARIES. 4) Create a query to display the last name and the number of weeks employed for all employees in department 90. Label the number of weeks column TENURE. Truncate the number of weeks value to 0 decimal places. Show the records in descending order of the employee’s tenure.
  • 3. 5) Display each employee’s last name, hire date, and salary review date, which is the first Monday after six months of service. Label the column REVIEW. Format the dates to appear in the format similar to “Monday, the Thirty-First of July, 2000.” 6) Create a report to display the manager number and the salary of the lowest-paid employee for that manager. Exclude anyone whose manager is not known. Exclude any groups where the minimum salary is $6,000 or less. Sort the output in descending order of salary. 7) Create a query to display the total number of employees and, of that total, the number of employees hired in 1995, 1996, 1997, and 1998. Create appropriate column headings. 8) Create a matrix query to display the job, the salary for that job based on department number, and the total salary for that job, for departments 20, 50, 80, and 90, giving each column an appropriate heading.
  • 4. 9) Create a query that displays the employee last name, job title, department name, salary, and grade for all employees. (Tables to be used Employees, Departments, Jobs) 10) Write a query to find the names and hire dates of all the employees who were hired before their managers, along with their managers’ names and hire dates. 11) Write a query that displays the employee number and last name of all employees who work in a department with any employee whose last name contains the letter “u.”
  • 5. 12) Create a table MY_EMPLOYEE which is a replicate of 'EMPLOYEES' table with all the data. 13) Add a new column USER_ID to MY_EMPLOYEE table and enforce a unique constraint. 14) Update the USER_ID column of MY_EMPLOYEE table with the following format. user_id should contain first letter of the last_name concatenated with first_name of the employee and the maximum length of the user_id should be 8. 15) Change the salary to $1,000 for all employees who have a salary less than $900 in MY_EMPLOYEE table. 16) Create a view named DEPT50 that contains the employee numbers, employee last names, and department numbers for all employees in department 50. Label the view columns EMPNO, EMPLOYEE, and DEPTNO. For security purposes, do not allow an employee to be reassigned to another department through the view. 17) Show all employees who were hired on the day of the week on which the highest number of employees were hired. 18) Write a query to get the nth highest salary among the employees. Query should accept a value for n. If n = 2, then it should retrieve all the employee names who are earning 2nd highest salary among the employees. 19) Suppose the primary key constraint has been disabled on employee_id column and users have entered duplicate employee_id's within the employee table. Write a query to remove the duplicate rows from the table and preserve the original employee_id which was existing.