





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Primary Key - correct answer is used to uniquely identify each row in a table Foreign Key - correct answer Used to reference or join data in different tables. In most cases the foreign key references a primary key in another table. Normalization Process - correct answer (1NF) repeating groups identified and a primary key is used. (2NF) Any partial dependencies are removed. (3NF) Transitive dependencies removed What type of relationship cannot be stored in a database - correct answer A many to many relationship because there would be no way to restructure or rejoin the data correctly. What represents a row in a table - correct answer a record What represents a column in a table - correct answer field When part of the data in a table depends on a field in the table that isn't the table's primary key, it's known as: - correct answer transitive dependency Which of the following is used to join data contained in two or more tables - correct answer Common field Which of the following SELECT statements displays a list of customer names from the CUSTOMERS table
when must a comma be used on the SELECT clause of a query - correct answer When listing more than one field ma,e and the fields aren't concatenated Which customers live in New Jersey? List each customer's name first name last name and state - correct answer select lastname, firstname, state from customers where state='NJ' / Which orders shipped after April 1, 2009? List each order number and the date it shipped. - correct answer select order#, shipdate from orders where shipdate>'01-APR-05' / Which books are not in the fitness category? list each book title and category. - correct answer select title, category from books where category<>'fitness' / which orders where placed on or before April, 1 2005 list each order number and order date write the query in 2 separate ways - correct answer Way 1: select order#, orderdate from orders where orderdate <='01-APR-05' / Write a statement that selects last names from new jersey and Georgia and puts them in descending order. - correct answer select lastname, state from customers
determine which orders haven't shipped yet and the name of the customer who placed the order. sort the results by the date on which the order was placed - correct answer SELECT c.firstname, c.lastname, o.order# FROM customers c JOIN orders o USING (customer#) WHERE o.shipdate IS NULL ORDER BY o.orderdate; produce a list of all customers who live in the state of Florida and have ordered books about computers.
AND c.lastname = 'NELSON'; diosplay a list of all books in the books table. if a book has been ordered by a customer, also list the corresponding order number and the state in which the customer resides - correct answer SELECT b.title, order#, c.state FROM books b LEFT OUTER JOIN orderitems i USING (isbn) LEFT OUTER JOIN orders USING (order#) LEFT OUTER JOIN customers c USING (customer#); produce a list of all customers names in which the first letter of the first and last names is in uppercase and the rest are in lowercase - correct answer Select INITCAP(firstname), INITCAP(lastname) FROM customers display a list of book titles and the percentage of markup for each book. the percentage of markup should be displayed as a whole number with no decimal positoin, followed by a percent sign - correct answer SELECT title, ROUND((retail-cost)/cost 100, 0)||'%' from books create a list of all book titles and costs. precede each book's cost with asterisks so that the width of the displayed cost field is 12 - correct answer SELECT title, LPAD(cost,12,'') from books / Determine the length of data stored in the isbn field of the books trable. make sure each different length value is displayed only once - correct answer SELECT DISTINCT LENGTH(isbn) FROM books / determine how many books are in the cooking category - correct answer select COUNT(*) FROM books
List the customers living in Georgia or Florida who have recently placed and order totaling more than $80 - correct answer SELECT DISTINCT firstname, lastname FROM customers, books, orders, orderitems WHERE customers.customer# = orders.customer# AND orders.order# = orderitems.order# AND orderitems.ISBN = books.ISBN AND (state = 'GA' OR state = 'FL') GROUP BY orders.order#, firstname, lastname HAVING SUM(retail*quantity) > 80; list the book title and retail price for all books with a retail price lower than the average retail price of all books sold by justlee books. - correct answer SELECT title, retail FROM books WHERE retail < (SELECT AVG(retail) FROM books); Determine which orders were shopped to the same state as order 1014 - correct answer SELECT order# FROM orders WHERE shipstate = (SELECT shipstate FROM orders WHERE order# = 1014); Determine which author or authors wrote the books most frequently purchased by customers of JustleeBooks - correct answer SELECT lname, fname FROM bookauthor JOIN author USING (authorid) WHERE isbn IN (SELECT isbn
FROM orderitems GROUP BY isbn HAVING SUM(quantity) = (SELECT MAX(COUNT()) FROM orderitems GROUP BY isbn) ); Determine which customers placed orders for the least expensive book in terms of reguyalr retail price carried by justlee books - correct answer SELECT customer# FROM customers JOIN orders USING (customer#) JOIN orderitems USING (order#) JOIN books USING (isbn) WHERE retail = (SELECT MIN(retail) FROM books); Determine which order had a higher total amount due than order 1008 - correct answer SELECT oi.order#, SUM(oi.quantityoi.paideach) FROM orderitems oi, books b WHERE oi.isbn = b.isbn GROUP BY oi.order# HAVING SUM(oi.quantityoi.paideach) > (SELECT SUM(oi.quantityoi.paideach) FROM orderitems oi, books b WHERE oi.isbn = b.isbn List the title of all books in the same category as books previously purchased by customer 1007nDOnt include books this customer already purchased. - correct answer SELECT title FROM books WHERE category IN