0% found this document useful (0 votes)
24 views

Tutorial Question

SQL is a powerful and widely used language for querying and managing data in relational database systems. It allows users to retrieve, insert, update, and delete data as well as manage schema objects. Some key capabilities of SQL include the ability to select specific columns, filter rows, sort results, group data, perform calculations, join tables, and subquery. SQL code is compact and set-based, making it highly performant for big data.

Uploaded by

黄佩珺
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Tutorial Question

SQL is a powerful and widely used language for querying and managing data in relational database systems. It allows users to retrieve, insert, update, and delete data as well as manage schema objects. Some key capabilities of SQL include the ability to select specific columns, filter rows, sort results, group data, perform calculations, join tables, and subquery. SQL code is compact and set-based, making it highly performant for big data.

Uploaded by

黄佩珺
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1 | The power of SQL

ANSWER THE QUESTION

INSTRUCTIONS:

It is an individual task

Duration 1 hour

Write your answer in the space provided.

SEND YOUR ANSWER in MS WORD TO [email protected]

QUESTION 1

List the details (emp_name,job, job and salary) of the employees whose salary is
greater than or equal to 1000

Answer:

SELECT e.emp_name AS ‘Employee Name’,


e.emp_job AS ‘Employee Job’,
e.emp_salary AS ‘Employee Salary’
FROM EMP_T e
WHERE (e.emp_salary >= 1000)

QUESTION 2

List the details (emp_name,job, job and salary) of the Managers whose salary is
greater than or equal to 1000

Answer:

SELECT e.emp_name AS ‘Employee Name’,


e.emp_job AS ‘Employee Job’
FROM EMP_T e
WHERE ((e.emp_job = ‘Manager’) AND
(e.emp_salary >= 1000))

QUESTION 4

List the details of employees who work in the department number 10 and the salary is
between 1500 and 3000

Answer:

SELECT *
FROM EMP_T e
WHERE ((e.dept_no = 10) AND
(e.emp_salary BETWEEN 1500 AND 3000))
2 | The power of SQL

QUESTION 5

List the employee numbers and names of all Salesmen or Manager who work in the
department number 30 and their salary is greater than or equal to 1500.

Answer:

SELECT e.emp_no AS ‘Employee Name’,


e.emp_name AS ‘Employee Name’
FROM EMP_T e
WHERE ((e.dept_no = 30) AND
(e.emp_salary >= 1500))

QUESTION 6

List the employee name whose name starts with an alphabet ‘M’ or ends with an
alphabet ‘N’

Answer:

SELECT e.emp_name AS ‘Employee Name’


FROM EMP_T e
WHERE (e.emp_name LIKE ‘M%N’)

QUESTION 7

List the employee name whose name start with the alphabet either ‘K’ or ‘F’ or ‘M’.

Answer:

SELECT e.emp_name AS ‘Employee Name’


FROM EMP_T e
WHERE (((e.emp_name LIKE ‘K%’) OR
(e.emp_name LIKE ‘F%’) OR
(e.emp_name LIKE ‘M%’))

QUESTION 8

List the employee name whose name has the alphabets ‘IN’ (in anywhere).

Answer:

SELECT e.emp_name AS ‘Employee Name’


FROM EMP_T e
WHERE (e.emp_name LIKE ‘%IN%’)
3 | The power of SQL

You might also like