Concept explainers
Instructions:
Write the suitable SQL statement to answer the following questions based on the following tables ( image for better table)
Table Name: Employee
EMP_ID FNAME LNAME SALARY JOIN_DATE DEP_NO
101 John Abraham 10000 01-JAN-13 11
202 Michael Clarke 80000 01-JAN-13 22
303 Roy Thomas 70000 01-FEB-13 11
404 Tom Jose 60000 01-FEB-13 22
505 Jerry Pinto 65000 01-FEB-13 22
606 Philip Mathew 75000 01-JAN-13 33
707 Thomas Jack 65000 01-JAN-13 33
Table Name: Reward
EMP_ID REWARD_DATE AMOUNT
101 01-FEB-13 5000
202 01-FEB-13 3000
303 01-FEB-13 4000
101 01-JAN-13 4500
202 01-JAN-13 3500
Table Name: Department
DEP_NO DEP_NAME
11 Banking
22 Insurance
33 Services
44 Marketing
the question is:
5. Retrieve number of Employee under each Department.
Step by stepSolved in 2 steps
- In SQL This sample database consists of the following tables(see image for tables and there is one more at the bottom in this text):• Customers: stores customer’s data• Products: stores a list of scale model cars• ProductLines: stores a list of product line categories• Orders: stores sales orders placed by customers• OrderDetails: stores sales order line items for each sales order• Payments: stores payments made by customers based on their accounts• Employees: stores all employee information as well as the organization structuresuch as who reports to whom• Offices: stores sales office data Write SQL code for the following:We want to add a new sale order for the customer (customerNumber = 145) in thedatabase. The steps of adding a sale order are described as follows:(1) Get latest sale order number from “orders” table, and use the next sale ordernumber as the new sale order number(2) Insert a new sale order into “orders” table for the customer (customerNumber =145). For this order, the…arrow_forwardInstructions: Write the suitable SQL statement to answer the following questions based on the following tables ( image for better table) Table Name: Employee EMP_ID FNAME LNAME SALARY JOIN_DATE DEP_NO 101 John Abraham 10000 01-JAN-13 11 202 Michael Clarke 80000 01-JAN-13 22 303 Roy Thomas 70000 01-FEB-13 11 404 Tom Jose 60000 01-FEB-13 22 505 Jerry Pinto 65000 01-FEB-13 22 606 Philip Mathew 75000…arrow_forwardSQL: Dog DataIn each question below, you will define a new table based on the following tables.CREATE TABLE parents ASSELECT "abraham" AS parent, "barack" AS child UNIONSELECT "abraham" , "clinton" UNIONSELECT "delano" , "herbert" UNIONSELECT "fillmore" , "abraham" UNIONSELECT "fillmore" , "delano" UNIONSELECT "fillmore" , "grover" UNIONSELECT "eisenhower" , "fillmore";CREATE TABLE dogs ASSELECT "abraham" AS name, "long" AS fur, 26 AS height UNIONSELECT "barack" , "short" , 52 UNIONSELECT "clinton" , "long" , 47 UNIONSELECT "delano" , "long" , 46 UNIONSELECT "eisenhower" , "short" , 35 UNIONSELECT "fillmore" , "curly" , 32 UNIONSELECT "grover" , "short" , 28 UNIONSELECT "herbert" , "curly" , 31;CREATE TABLE sizes ASSELECT "toy" AS size, 24 AS min, 28 AS max UNIONSELECT "mini" , 28 , 35 UNIONSELECT "medium" , 35 , 45 UNIONSELECT "standard" , 45 , 60; Q2: By Parent HeightCreate a table by_parent_height that has a column of the names of all dogs that have a parent,ordered by the height…arrow_forward
- order db orderid int custid int itemcode int orderquantity int deliverydate date modeofpayment char(1) date_of_order datearrow_forwarduse sql please List only the movies that have a value for gross (not NULL values). Include all columns in the result set.arrow_forwardInstructions: Write the suitable SQL statement to answer the following questions based on the following tables ( image )the question is:2. Get employee details from employee table whose first name starts with 'J', order the result descending.arrow_forward
- Instructions: Write the suitable SQL statement to answer the following questions based on the following tables ( image for better table) Table Name: Employee EMP_ID FNAME LNAME SALARY JOIN_DATE DEP_NO 101 John Abraham 10000 01-JAN-13 11 202 Michael Clarke 80000 01-JAN-13 22 303 Roy Thomas 70000 01-FEB-13 11 404 Tom Jose 60000 01-FEB-13 22 505 Jerry Pinto 65000 01-FEB-13 22 606 Philip Mathew 75000…arrow_forwardSQL: Dog DataIn each question below, you will define a new table based on the following tables.CREATE TABLE parents ASSELECT "abraham" AS parent, "barack" AS child UNIONSELECT "abraham" , "clinton" UNIONSELECT "delano" , "herbert" UNIONSELECT "fillmore" , "abraham" UNIONSELECT "fillmore" , "delano" UNIONSELECT "fillmore" , "grover" UNIONSELECT "eisenhower" , "fillmore";CREATE TABLE dogs ASSELECT "abraham" AS name, "long" AS fur, 26 AS height UNIONSELECT "barack" , "short" , 52 UNIONSELECT "clinton" , "long" , 47 UNIONSELECT "delano" , "long" , 46 UNIONSELECT "eisenhower" , "short" , 35 UNIONSELECT "fillmore" , "curly" , 32 UNIONSELECT "grover" , "short" , 28 UNIONSELECT "herbert" , "curly" , 31;CREATE TABLE sizes ASSELECT "toy" AS size, 24 AS min, 28 AS max UNIONSELECT "mini" , 28 , 35 UNIONSELECT "medium" , 35 , 45 UNIONSELECT "standard" , 45 , 60;Q1: Size of DogsThe Fédération Cynologique Internationale classifies a standard poodle as over 45 cm and up to 60 cm.The sizes table…arrow_forwardsql code sql code sql codearrow_forward
- Using DML SQL, write the appropriate SQL query for each of the following:a) Insert A new customer with the following information:(Name: Ali, SSN: 1111, Address: Riyadh, Phone: 05555)b) Delete all the loans for customer with SSN: 2222c) Select all customer who got loans more than 250000 SAR, print the customers SSN, named) Print all the Accounts in Bank: ALBILAD and in branch no: 5arrow_forwardPlease use MySQL language and mySQL as serverarrow_forwardSQL based questionarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education