SQL Programming Language
Description: This test consists of questions related to SQL queries for database. | |
Number of Questions: 15 | |
Created by: Karuna Seth | |
Tags: SQL database practice test programming language questions SQL test SQL questions Database |
Consider the following database table- Table Name- Items_Ordere |||||| |---|---|---|---|---| |Customer_ID|Order_date|Item|Quantity|Price| |77120|6-Jul-1999|Belt|1|140| |77121|1-Jul-1999|Watch|4|1230| |77122|30-Jun-1999|T-shirt|6|1020| |77123|12-June-1999|Fan|1|950.50| |77124|30-Aug-1999|Cooler|1|4010.20| |77125|30-May-1999|Bag|7|2950| |77126|1-Jun-1999|Shoes|2|1280| |77122|12-Feb-1999|Jeans|2|2000| |77124|1-Aug-2000|Jacket|1|1260|
How will you find the number of orders made by each customer? Select the correct option.
Consider the following database tables
Table Name- Jo ||| |---|---| |job_ID|Designation| |101|Clerk| |102|Analyst| |103|Manager|
Table Name- Employe |||||| |---|---|---|---|---| |EMPLOYEE_ID|FIRST_NAME|LAST_NAME|job_ID|MANAGER_ID| |7271|Amit|Saxena|102|4101| |7272|Anil|Sharma|103|4102| |7273|Mohit|Rajput|101|4103|
Find the Employee's first name and last name according to their job id. Select the correct option.
Consider the following database table- Table Name- Items_Ordere |||||| |---|---|---|---|---| |Customer_ID|Order_date|Item|Quantity|Price| |77120|6-Jul-1999|Belt|1|140| |77121|1-Jul-1999|Watch|4|1230| |77122|30-Jun-1999|T-shirt|6|1020| |77123|12-June-1999|Fan|1|950.50| |77124|30-Aug-1999|Cooler|1|4010.20| |77125|30-May-1999|Bag|7|2950| |77126|1-Jun-1999|Shoes|2|1280| |77121|3-Sep-2000|Watch|5|1800| |77125|12-Feb-2001|Jeans|6|4050| |77122|12-Feb-1999|Jeans|2|2000| |77124|1-Aug-2000|Jacket|1|1260|
Display the maximum and mimimum price of each specific item, if the price that item is more than 1500. Select the correct option.
Consider the following database table
Table Name- Items_Ordere |||||| |---|---|---|---|---| |Customer_ID|Order_date|Item|Quantity|Price| |77120|6-Jul-1999|Belt|1|140| |77121|1-Jul-1999|Watch|4|1230| |77122|30-Jun-1999|T-shirt|6|1020| |77123|12-Jun-1999|Fan|1|950.50| |77124|30-Aug-1999|Cooler|1|4010.20| |77125|30-May-1999|Bag|7|2950| |77126|1-Jun-1999|Shoes|2|1280| |77121|3-Sep-2000|Watch|5|1800| |77125|12-Feb-2001|Jeans|6|4050| |77122|12-Feb-1999|Jeans|2|2000| |77124|1-Aug-2000|Jacket|1|1260|
Calculate the average price of all of the items ordered that were purchased in the month of June. Select the correct option.
Consider the following database table
Table Name- Employe ||||| |---|---|---|---| |Employee_ID|Dept no|Job|Salary| |120|201|Clerk|20,000| |121|202|Manager|22,000| |122|203|Head|32,000| |123|204|Sr. Manager|46,000| |124|205|Boss|40,000| |125|206|HR|23,000| |126|207|Shoes|26,000| ||
Which of the following is the correct query to find the highest salaries for each department in it for each job from the employee table?
Consider the following database table
Table Name- Customer |||||| |---|---|---|---|---| |customerid|firstname|lastname|city|state| |001|Adam|Smith|Pinetop|Arizona| |002|Sarah|Graham|Nogales|Arizona| |003|Linda|Giles|Durango|Colorado| |004|Lisa|Howell|Kailua|Hawaii| |005|Anthony|Davids|Greensboro|North Carolina| |006|Kevin|Smith|Yuma|Arizona| |007|Dalton|Howell|Tillamook|Oregon| |008|Donald|Steyn|Lynden|Washington| |009|Angelo|Mathhews|Pocatello|Idaho| |010|Albie|Morne|Snoqualmie|Washington|
Select the firstname, city, and state from the customers table, where the state is either Arizona, Washington, Oklahoma, Colorado.
Consider the following database table
Table Name- Em ||||| |---|---|---|---| |Deptno|job|department|city| |001|Manager|Sales|Kolkata| |002|Coordinator|Ministry|Delhi| |003|Clerk|HR|Delhi| |004|Clerk|Industry|Mumbai| |005|Developer|Technical dept|Banglore|
Find the number of Clerk’s working for each department.
Consider the following database table
Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow|
Find the details of employees who are earning the highest salary in each department.
Which of the following is/are the correct alternative to determine the nature of expression in Select clause?
Consider the following database table
Table Name- Items_Ordere |||||| |---|---|---|---|---| |Customer_ID|Order_date|Item|Quantity|Price| |77120|6-Jul-1999|Belt|1|140| |77121|1-Jul-1999|Watch|4|1230| |77122|30-Jun-1999|T-shirt|6|1020| |77123|12-Jun-1999|Fan|1|950.50| |77124|30-Aug-1999|Cooler|1|4010.20| |77125|30-May-1999|Bag|7|2950| |77126|1-Jun-1999|Shoes|2|1280| |77121|3-Sep-2000|Watch|5|1800| |77125|12-Feb-2001|Jeans|6|4050| |77122|12-Feb-1999|Jeans|2|2000| |77124|1-Aug-2000|Jacket|1|1260|
Select the item and price for all of the items in the items_ordered table that the price is greater than 1500. Display the results in ascending order based on the price. Select the correct option.
Consider the following database table
Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow|
Find the details of employees earning the highest salary.
Consider the following database table
Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow|
Find the details of employees earning the second highest salary.
Consider the following database table
Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow| and Table name-Dep ||| |---|---| |Deptno|deptname| |501|sales| |502|Hr| |503|CS| |504|EC|
Find the details of departments in which employees are not working.
Consider the following database table
Table Name- Customer |||||| |---|---|---|---|---| |customerid|firstname|lastname|city|state| |001|Adam|Smith|Pinetop|Arizona| |002|Sarah|Graham|Nogales|Arizona| |003|Linda|Giles|Durango|Colorado| |004|Lisa|Howell|Kailua|Hawaii| |005|Anthony|Davids|Greensboro|North Carolina| |006|Kevin|Smith|Yuma|Arizona| |007|Dalton|Howell|Tillamook|Oregon| |008|Donald|Steyn|Lynden|Washington| |009|Angelo|Mathhews|Pocatello|Idaho| |010|Albie|Morne|Snoqualmie|Washington|
How many people are in each unique state in the customers table?
Consider the following database table
Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow| and Table name-Dep ||| |---|---| |Deptno|deptname| |501|sales| |502|Hr| |503|CS| |504|EC|
Find the details of departments in which employees are working.