Concept explainers
Use SQL commands to finish the questions. Please include BOTH SQL commands and results in your answers.
1. List the first and last names of customers with credit limits of $1,000 or more.
2. List the order number for each order placed by customer number 125 on 11/15/2021.
3. List the item ID and description of each item that is not in category ‘HOR’.
4. List the item ID, description, and on-hand value for each item where on-hand value is at least $1,500. Assign the name ON_HAND_VALUE to the computed column. (Hint: On-hand value is the production of the units on hand and price.)
5. Use the IN operator to list the item ID and description of each item in category FSH or BRD or CAT.
6. Find the total of the balances for all customers represented by sales rep 10 with balances that are less than their credit limits.
7. List the item ID, description, and on-hand value of each item whose number of units on hand is more than the average number of units on hand for all items. (Hint: Use a subquery.)
8. What is the price of the least expensive item in the
9. List the sum of the balances of all customers for each sales rep but restrict the output to those sales reps for which the sum is more than $150. Order the results by sales rep ID.
10. List the item ID of any item with an unknown description.
SQL :
SQL (Structured Query Language) is a programming language used to manage and manipulate relational databases. Here are some common SQL commands:
- SELECT: This command is used to retrieve data from one or more tables in a database.
- INSERT: This command is used to add new data to a table.
- UPDATE: This command is used to modify existing data in a table.
- DELETE: This command is used to remove data from a table.
- CREATE TABLE: This command is used to create a new table in a database.
- DROP TABLE: This command is used to delete a table from a database.
- ALTER TABLE: This command is used to modify the structure of an existing table.
- CREATE INDEX: This command is used to create an index on one or more columns of a table to speed up data retrieval.
- GROUP BY: This command is used to group rows in a table based on one or more columns.
- ORDER BY: This command is used to sort the result set of a query in ascending or descending order based on one or more columns.
- JOIN: This command is used to combine rows from two or more tables based on a related column between them.
- DISTINCT: This command is used to retrieve only unique values from a column.
- WHERE: This command is used to filter data based on a specified condition.
- HAVING: This command is used to filter the result set of a GROUP BY query based on a specified condition.
- LIMIT: This command is used to limit the number of rows returned by a query.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Please solve question no. 10 including screenshots of SQL results.
Need help with solutions to questions 7 to 9.
Only answered 3 questions. The other 7 are missing.
Please solve question no. 10 including screenshots of SQL results.
Need help with solutions to questions 7 to 9.
Only answered 3 questions. The other 7 are missing.
- Please help: Using the following sql file, how would you find 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. Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End; //* Assignment_1 */ 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…arrow_forwardWrite queries in SQL to answer each of the following questions: 1. Find all students in Comp. Sci. dept 2. Find all students with total credits > 100 3. Find all students who took course in Spring 2010 (Remove duplicates please) 4. Find all courses taken by the student whose ID is 76543 and also find his name create table student (ID varchar(5), name varchar(20) not null, dept_name varchar(20), tot_cred numeric(3,0), primary key (ID) ); create table takes (ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2), primary key (ID, course_id, sec_id, semester, year) ); insert into student values ('00128', 'Zhang', 'Comp. Sci.', '102'); insert into student values ('12345', 'Shankar', 'Comp. Sci.', '32'); insert into student values ('19991', 'Brandt', 'History', '80'); insert into student values ('23121', 'Chavez', 'Finance', '110'); insert into student values ('44553', 'Peltier', 'Physics', '56'); insert into student values…arrow_forwardWrite the SQL code that will produce the results shown as below. Write the SQL code to calculate the ASSIGN_CHARGE values in the ASSIGNMENT table. Note that ASSIGN_CHARGE is a derived attribute that is calculated by multiplying ASSIGN_CHG_HR by ASSIGN_HOURS. Write the SQL code that will yield the total number of hours worked for each employee and the total charges stemming from those hours worked. The result is shown as below.arrow_forward
- answer with proper explanation and step by step solution. Question write a PL/ SQL program to display the number of products whose price is 100 dh more or less than the price defined the for substitution variable use the define command to specify the price pass this value to the PL/SQL black using a substitution variablearrow_forwardWrite SQL CODE List all the Course Code (CRS_CODE) that are taught by a Professor that does not hold "Ph.D." as the highest degree (based on PROF_HIGH_DEGREE in the PROFESSOR table).arrow_forwarduse sql to answer the following question To perform below tasks, refer to tables in the JustLee Book database. Create a list that display the title of each book and the name and phone number of the contact at the publisher’s office for reordering each book. Which books were written by an author with the Last Name-First Name (BAKER JACK)? Perform the search using author’s last name/first name. Determine which book(s) purchased by customer Steve Schell. Perform the search using the customer name & last name, not the customer number. If he/she has purchased multiple copies of the same book, unduplicated(DISCTINC) the result.arrow_forward
- TAL Distributors would like to know the number of months between the current date and the order date of an order. Write an SQL statement in MySQL that displays the order number and the number of months between the current date and the order date. The number of months should display as an integer. (Hint: You can nest one function within another function.) Snip and paste the SQL command(s) and results below.arrow_forwardUse SQL and TAL Distributors database to complete the following questions:List the customer number and name for all customers located in the city of Grove. Your query should ignore case. For example, a customer with the city Grove should be included as should customers whose city is GROVE, grove, GrOvE, and so on.arrow_forward7. List the shipping city and state for the order that had the longest shipping delay. SQL commandsarrow_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