can you help me solving those SQL questions please The database schema is: 1. Wr
ID: 3757124 • Letter: C
Question
can you help me solving those SQL questions please The database schema is: 1. Write a query to display the name, product line, and buy price of all products. The output columns should display as “Name”, “Product Line”, and “Buy Price”. The output should display the most expensive items first. 2. Write a query to display the first name, last name, and city for all customers from Germany. Columns should display as “First Name”, “Last Name”, and “City”. The output should be sorted by the customer’s last name (ascending). 3. Write a query to display each of the unique values of the status field in the orders table. The output should be sorted alphabetically increasing. Hint: the output should show exactly 6 rows. 4. Select all fields from the payments table for payments made on or after January 1, 2005. Output should be sorted by increasing payment date. 5. Write a query to display all Last Name, First Name, Email and Job Title of all employees working in the San Francisco office. Output should be sorted by last name. 6. Write a query to display the Name, Product Line, Scale, and Vendor of all of the car products – both classical and vintage. The output should display all vintage cars first (sorted alphabetically by name), and all classical cars last (also sorted alphabetically by name).
Explanation / Answer
1.
Select productName as Name , productLine as "Product Line" , buyPrice as "Buy Price" from products order by MSRP desc;
2.
Select contactFirstName as "first name",contactLastName as "last name ",city as "City" from customers where country = 'Germany' order by contactLastName;
3.
Select distinct status from orders order by status;
4.
Select * from payments where paymentDate >= 'January 1, 2005' order by paymentDate;
5.
Select lastName,firstName,email,jobTitle from employees inner join offices on employees.officeCode = offices.officeCode where city = 'San Francisco' order by lastName;
6.
Select productName,productLine,productScale,productVendor from products where productName LIKE '%Car%' order by productName desc;
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.