SQL 1. Create a table copy of an existing table that only you can use. Call the
ID: 3886031 • Letter: S
Question
SQL
1. Create a table copy of an existing table that only you can use. Call the new table "Authors_Copy". The new table should contain the last names, first names, and cities of all authors who live in California.
2. Write a SELECT statement that returns columns titled as Publisher ID and Publisher Name from the publishers table.
3. Write a select statement that retrieves the title and price of all books that cost between $10 and $15. (You may use the numbers 10 and 15 without dollar signs.)
4. Retrieve the employee ID, last name, and job level for all employees that are a job level 35, 100, or 200.
5. Retrieve all titles for which the royalty is unknown.
6. Retrieve the store ID, title ID, order date, and quantity sold for all sales in 1994 from stores that either sold 20 or more copies of a single title or had a payment term of “Net 30” days.
7. Write a SELECT statement that prints the roysched table with royalty increased by 1. Call the new value “New Royalty”.
Explanation / Answer
There is no schema you have given, I have assumed the column name and table name according to the question. You can change them as per your schema. Let me know if you have any doubts.
Please give the thumbs up, if it is helpful for you!!.
#1)
SELECT last_names, first_names, cities
INTO Authors_Copy
FROM Authors
WHERE cities= 'California';
#2)
SELECT PublisherID, PublisherName
FROM publishers;
#3)
SELECT title, price
FROM books
WHERE cost BETWEEN 10 AND 15;
#4)
SELECT employeeID, lastname, joblevel
FROM employees
wHERE joblevel in (35,100,200);
#5)
SELECT titles
FROM books
WHERE royalty = 'unknown';
#6)
SELECT storeID, titleID, orderdate, quantity_sold
FROM sales
WHERE year=1994 AND ( quantity_sold >=20 OR payment_term=30);
#7)
SELECT royalty+1 as New_Royalty
FROM roysched ;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.