Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please read carefully! Create SQL statements for each of the following. Make sur

ID: 3905573 • Letter: P

Question

Please read carefully! Create SQL statements for each of the following. Make sure to test each file (using the Parse button) before executing it. When you are done, copy and paste all of your SQL statements into a single query window in SQL Server. Make sure the statements are in the same order as the questions listed here, and save your work as a.sql script. Submit your sql script on TITANium. 1. Write an SQL statement to list all columns for customers with a Seattle address. 2. Write an SQL statement to list all cities where customers live. Make sure the result does not include duplicates. 3. Write an SQL statement to list the first and last name of all employees who have the last name of Stuart or the first name of John. 4. Write an SQL statement to list the item description and item cost of all items with a cost between $595 and $705. 5. Write an SQL statement to list the company names and fax numbers of all vendors who have a fax number listed in the table. Sort the result in descending order by company name. 6. Write an SQL statement to list the minimum, maximum, and average item price of all items with an item cost greater than $2000. 7. Write an SQL statement to count the number of items that have a price above $4000. 8. Write an SQL statement to list the item description of all items whose description starts with "Antique"

Explanation / Answer

Sol:

Let the Table name is Datasheet.

consider the relevant columns/data are present in table. MS SQL server is case insensitive

1)select * from Datasheet where address = 'seattle' ( consider a coloumn name address)

2)select distinct city from Datasheet where availability = 'yes' (consider a column name city and availabilty with yes or no)

3)SELECT * FROM DATASHEET WHERE EMPLOYEE NAME LIKE 'John%' OR EMPLOYEE NAME LIKE '%Stuart'

4)SELECT item description,item cost FROM Datasheet WHERE item cost > 595 AND item cost <705

5)SELECT company name, fax numbers FROM Datasheet WHERE ORDER BY company name DESC

6)SELECT MIN(item price) min, MAX(item price) max,AVG(item price) FROM Datasheet where cost>2000

7)SELECT COUNT(item number) FROM Datasheet where item cost >4000

8)SELECT * FROM Datasheet WHERE item description LIKE 'Antique%'

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote