EBK DATABASE SYSTEMS: DESIGN, IMPLEMENT
12th Edition
ISBN: 8220101450739
Author: Morris
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 25P
Program Plan Intro
ORDER BY Clause:
SQL contains “ORDER BY” clause in order to sort rows. The values get sorted in ascending as well as descending order. The keyword used to sort values in ascending order is “ASC” and for descending order is “DESC”. By default, it sorts values by ascending order.
Syntax:
SELECT column_Name1, column_Name2 FROM table_Name ORDER BY column_Name2;
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Considering Vaccination Database, write queries to:
Display the Subject CNIC, Name, Contact, Dose1 Center, and Dose2 Center as shown below:
CNIC
Name
Contact
Dose1 Center
Dose2 Center
22401-6645321-1
Nasir
3409991112
Lachi
Kohat 2
14301-6045321-5
Shahab
3409991112
kohat 3
Dara
The subjects who have been vaccinated different types in Dose1 and Dose2. For instance, subjects who were vaccinated ‘Sinovac’ in the first dose, while Pfizer in the second dose.How many Viles of each type have been consumed so far. How many subjects are vaccinated from expired viles. Suggest the name of Incharge for the best performance award based on the highest number of subjects vaccinated on a single day
Please help with the following:
Write following SQL Queries:A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION,
List all the rows in which the prescription dates occur on or after November 14.
How many doctors provide prescriptions with 30 tablets in total?
List doctor’s details where speciality is either Dermatology or Neurology. (Use INoperator). List the results by the first name in ascending order and the last name indescending order
Find all patients rows whose first names include ‘George’ (Assume case sensitivity).
List number of patients that do not have a phone number.
How many drugs with price < 40$?
How many prescriptions are generated for each patient, limit the listing to patients who
have more than 2 prescriptions?
List the drug codes and prices (rounded to one decimal place).
How many doctors prescribe the drug code KO15?
List all drugs with their expiration date (one year from the date of manufacturer)…
Use your ERD to define the table structures in the database using SQL DDL commands to build your schema.
Chapter 7 Solutions
EBK DATABASE SYSTEMS: DESIGN, IMPLEMENT
Ch. 7 - Prob. 1RQCh. 7 - Explain why the following command would create an...Ch. 7 - Prob. 3RQCh. 7 - Explain why it might be more appropriate to...Ch. 7 - What is the difference between a column constraint...Ch. 7 - What are referential constraint actions?Ch. 7 - Rewrite the following WHERE clause without the use...Ch. 7 - Explain the difference between an ORDER BY clause...Ch. 7 - Explain why the following two commands produce...Ch. 7 - What is the difference between the COUNT aggregate...
Ch. 7 - Prob. 11RQCh. 7 - Prob. 12RQCh. 7 - Write the SQL code that will create the table...Ch. 7 - Having created the table structure in Problem 1,...Ch. 7 - Prob. 3PCh. 7 - Prob. 4PCh. 7 - Write the SQL code to change the job code to 501...Ch. 7 - Write the SQL code to delete the row for William...Ch. 7 - Write the SQL code that will restore the data to...Ch. 7 - Write the SQL code to create a copy of EMP_1,...Ch. 7 - Write the SQL code to change the EMP_PCT value to...Ch. 7 - Using a single command sequence, write the SQL...Ch. 7 - Prob. 11PCh. 7 - Write the SQL code that will change the PROJ_NUM...Ch. 7 - Write the two SQL command sequences required to:...Ch. 7 - Prob. 14PCh. 7 - Prob. 15PCh. 7 - Using the EMPLOYEE, JOB, and PROJECT tables in the...Ch. 7 - Write the SQL code that will produce the same...Ch. 7 - Write the SQL code to find the average bonus...Ch. 7 - Prob. 19PCh. 7 - Prob. 20PCh. 7 - Write the SQL code to calculate the ASSIGN_CHARGE...Ch. 7 - Using the data in the ASSIGNMENT table, write the...Ch. 7 - Prob. 23PCh. 7 - Write the SQL code to generate the total hours...Ch. 7 - Prob. 25PCh. 7 - Prob. 26PCh. 7 - Prob. 27PCh. 7 - Generate a listing of all purchases made by the...Ch. 7 - Using the output shown in Figure P7.29 as your...Ch. 7 - Prob. 30PCh. 7 - Prob. 31PCh. 7 - Use a query to compute the average purchase amount...Ch. 7 - Prob. 33PCh. 7 - Prob. 34PCh. 7 - Prob. 35PCh. 7 - Prob. 36PCh. 7 - Prob. 37PCh. 7 - Using the results of the query created in Problem...Ch. 7 - Create a query to find the balance characteristics...Ch. 7 - Prob. 40PCh. 7 - Prob. 41PCh. 7 - Prob. 42PCh. 7 - Prob. 43PCh. 7 - Prob. 44PCh. 7 - Write a query to display the SKU (stock keeping...Ch. 7 - Prob. 46PCh. 7 - Prob. 47PCh. 7 - Prob. 48PCh. 7 - Prob. 49PCh. 7 - Prob. 50PCh. 7 - Prob. 51PCh. 7 - Prob. 52PCh. 7 - Prob. 53PCh. 7 - Prob. 54PCh. 7 - Prob. 55PCh. 7 - Prob. 56PCh. 7 - Prob. 57PCh. 7 - Prob. 58PCh. 7 - Prob. 59PCh. 7 - Prob. 60PCh. 7 - Prob. 61PCh. 7 - Prob. 62PCh. 7 - Prob. 63PCh. 7 - Prob. 64PCh. 7 - Prob. 65PCh. 7 - Prob. 66PCh. 7 - Prob. 67PCh. 7 - Prob. 68PCh. 7 - Prob. 69PCh. 7 - Prob. 70PCh. 7 - Prob. 71PCh. 7 - Prob. 72PCh. 7 - Prob. 73PCh. 7 - Prob. 74PCh. 7 - Prob. 75PCh. 7 - Prob. 76PCh. 7 - Prob. 77PCh. 7 - Prob. 78PCh. 7 - Prob. 79PCh. 7 - Prob. 80PCh. 7 - Prob. 81PCh. 7 - Prob. 82PCh. 7 - Prob. 83PCh. 7 - Prob. 84PCh. 7 - Prob. 85PCh. 7 - Prob. 86PCh. 7 - Prob. 87PCh. 7 - Prob. 88PCh. 7 - Prob. 89PCh. 7 - Prob. 90PCh. 7 - Prob. 91PCh. 7 - Prob. 92PCh. 7 - Prob. 93PCh. 7 - Prob. 94PCh. 7 - Prob. 95PCh. 7 - Write the SQL code to create the table structures...Ch. 7 - The following tables provide a very small portion...Ch. 7 - Write the SQL command to save the rows inserted in...Ch. 7 - Write the SQL command to change the movie year for...Ch. 7 - Prob. 100CCh. 7 - Prob. 101CCh. 7 - Prob. 102CCh. 7 - Prob. 103CCh. 7 - Prob. 104CCh. 7 - Prob. 105CCh. 7 - Prob. 106CCh. 7 - Prob. 107CCh. 7 - Prob. 108CCh. 7 - Prob. 109CCh. 7 - Prob. 110CCh. 7 - Prob. 111CCh. 7 - Prob. 112CCh. 7 - Prob. 113CCh. 7 - Prob. 114CCh. 7 - Prob. 115CCh. 7 - Prob. 116CCh. 7 - Prob. 117CCh. 7 - Prob. 118CCh. 7 - Prob. 119CCh. 7 - Prob. 120CCh. 7 - Prob. 121CCh. 7 - Prob. 122CCh. 7 - Prob. 123CCh. 7 - Prob. 124CCh. 7 - Write a query to display the movie number, movie...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write the SQL code to calculate the ASSIGN_CHARGE values in the ASSIGNMENT table in the Ch07_ConstructCo database. (See Figure P7.1.) Note that ASSIGN_CHARGE is a derived attribute that is calculated by multiplying ASSIGN_CHG_HR by ASSIGN_HOURS.arrow_forwardProblem 1 and 2 are based on the following query: SELECT EMP_LNAME, EMP_FNAME, EMP_AREACODE, EMP_SEX FROM EMPLOYEE WHERE EMP_SEX = 'F' AND EMP_AREACODE = '615' ORDER BY EMP_LNAME, EMP_FNAME; What indexes should you create? Write the required SQL commands.arrow_forwardReview the data for the TRIP table in Figure 1-5 in Chapter 1 and then review the data types used to create the TRIP table in Figure 3-39. Suggest alternate data types for at least two fields that currently have the CHAR data type and at least two fields that currently have the DECIMAL data type. Create but do not execute the SQL command to create the TRIP table using these alternate data types.arrow_forward
- QUICK SQL REQUEST (beginner level...) Back at work on Monday morning, the Vice President of Purchasing asks you to help him with the analysis of in-process storage. He asks you to pull information regarding the number of products per storage location. The result of the query should show: - The name of the warehouse (Location) - The number of different products per storage location - The total quantity of products found at this storage location - The average price of all products found at this storage location He mentions that for the moment he is only interested in the locations that have more than 50 distinct products because he wants to start inventorying the biggest locations first. Show the locations in order of smallest to largest number of distinct products. My request is linked to the question but i'm having trouble executing it I would love to know how to do it, thanks in advance.arrow_forwardHi I hope you can help me. I will rate the answer. Use MYSQL do it in a .sql format. Also please provide comments for each step. Thanks in advance! Create a Bank database. Create two tables which attributes are given as below:(a) Customer: customer id integer, name varchar, lastname varchar,registration date date(b) Branch: branch id integer, branch name varchar, cash hold float,foundation date dateCreate a Loan table that stores the loans acquired by the customers from the particular branch of the bank. Determine the attributesof the table. Justify your answer with comments.Choose primary and foreign keys depending on the relationsin Bank database design. If there is no need for a foreign key explain why.Justify your answer with comments.Populate each table with at least 5 different records. Show IDs of all customers who loaned from the second branchof the Bank. Add score attribute to Customer table. Add liabilityattribute to Branch table. Write a SQL command that automatically…arrow_forwardWhat is the minimum number of database requests you need to write for an inventory update for both PRODUCT and PART? Using proper SQL syntax for an Oracle database, write each request below.arrow_forward
- Please help with the following: Using oracle sql live or sql developer what sql statements could be use to find the following: A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION, is now loaded with this assignment and you are ready to start. Please explore the database and then write the appropriate SQL command. 1. List all the rows in which the prescription dates occur on or after November 14. 2. How many doctors provide prescriptions with 30 tablets in total? Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End;//* */ ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';CREATE TABLE DOCTOR (DOC_ID varchar2(5) PRIMARY KEY,DOC_LNAME varchar2(15),DOC_FNAME varchar2(15),DOC_INITIAL varchar2(1),DOC_SPECIALTY varchar2(15));INSERT INTO DOCTOR VALUES('29827','Sanchez','Julio','J','Dermatology');INSERT INTO DOCTOR…arrow_forwardWrite the appropriate SQL query for each of the following questions: Display the list of students who are involved in the IT club Display the details of all the activities that have taken place in 'Salalah Hall'arrow_forwardCreate a query that will show the person id and fee for all players in the football database. Additionally create a column in your output to show the amount of increase if the fee were increased by 20%. Also produce a column that will show what the new fee would be with the 20%. Sort your results showing those that do not pay a fee at the bottom of your list. Finally make sure your column headings read: Person ID, Current Fee, Increase and New Fee. Make sure your spelling and case EXACTLY match what is specified.arrow_forward
- Using the university schema, write an SQL query to find the names and IDs ofthose instructors who teach every course taught in his or her department (i.e.,every course that appears in the course relation with the instructor’s department name). Order result by namearrow_forwardAssume a database of Employees of a company have been given as shown below: Employee: Projects: Use SQL queries to find the followings: Find the average salary paid to the employees working in each project together with the project name. For each project, count the number of employees who are paid less than the average salary of that project. Find the name of the projects which have no employees assigned. Determine if there is any project with a budget less than the total salary paid to its employees. If yes, find the name of the project and its budget. The management wants to know which projects have been finished. Add an attribute to Projects table names status to show the current state of the project (Use SQL)arrow_forwardupdate the JustLee Books database by executing the JLDB_Build_11.sql script, otherwise your solutions might not work! What's the retail price of the most expensive book written by Sam Smith? Determine the total profit generated by sales per customer. Note: Quantity should be reflected in the total profit calculation. Modify problem 2 to include only those customers who live in FL. Modify problem 3 to display the results with profit greater then $50. Determine the average retail price of books by publisher name and category. Include only the categories Children and Computer and the groups with an average retail price greater than $50.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage LearningA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr