diff --git a/part-1.sql b/part-1.sql new file mode 100644 index 0000000..c32f5c3 --- /dev/null +++ b/part-1.sql @@ -0,0 +1,4 @@ +# part-1 +SELECT productName,productLine,buyPrice +FROM products +ORDER by buyPrice DESC diff --git a/part-2.sql b/part-2.sql new file mode 100644 index 0000000..38b4f40 --- /dev/null +++ b/part-2.sql @@ -0,0 +1,10 @@ +# part-2 +#Write a query to display the first name, last name, and city for all customers from Germany. +#olumns should display as First Name, Last Name, and City. +#The output should be sorted by the customer’s last name (ascending). + + +SELECT contactFirstName,contactLastName,city +FROM customers +WHERE country='Germany' +ORDER by contactLastName ASC diff --git a/part-3.sql b/part-3.sql new file mode 100644 index 0000000..003e52b --- /dev/null +++ b/part-3.sql @@ -0,0 +1,9 @@ +#part-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. + +SELECT DISTINCT STATUS +FROM orders + +ORDER by STATUS ASC diff --git a/part-4.sql b/part-4.sql new file mode 100644 index 0000000..3bbfc9d --- /dev/null +++ b/part-4.sql @@ -0,0 +1,10 @@ +# part-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. + +SELECT * +FROM payments +WHERE paymentDate<= '2005-01-1' +ORDER by paymentDate ASC + diff --git a/part-5.sql b/part-5.sql new file mode 100644 index 0000000..d4e5582 --- /dev/null +++ b/part-5.sql @@ -0,0 +1,9 @@ +# part-5 + +#Write a query to display all Last Name, First Name, Email and Job Title of all employees working out of the San Francisco office. +#Output should be sorted by last name. + +SELECT lastName,firstName,email,jobTitle,city +FROM employees,offices +WHERE city= 'San Francisco' +ORDER by lastName ASC \ No newline at end of file diff --git a/part-6.sql b/part-6.sql new file mode 100644 index 0000000..01df052 --- /dev/null +++ b/part-6.sql @@ -0,0 +1,8 @@ + +#Write a query to display the Name, Product Line, Scale, and Vendor of all of the car products – both classic and vintage. +#The output should display all vintage cars first (sorted alphabetically by name), and all classic cars last (also sorted alphabetically by name). + +SELECT productName,productLine,productScale,productVendor +FROM products +WHERE productLine='Classic Cars'|| productLine='Vintage Cars' +ORDER by productLine DESC,productName ASC \ No newline at end of file