AND SOLUTIONS RATED A+
✔✔Write the SQL query to "Find the total quantity of units of all products that
Salesperson 137 has sold": - ✔✔SELECT SUM(QUANTITY)
FROM SALES
WHERE SPNUM=137;
✔✔Write the SQL query to "Find the name of the salesperson responsible for Customer
Number 1525": - ✔✔SELECT SPNAME
FROM SALESPERSON, CUSTOMER
WHERE SALESPERSON.SPNUM=CUSTOMER.SPNUM
AND CUSTNUM=1525;
✔✔Write the SQL query to "List the NAMES of the products of which salesperson
Adams has sold more than 2000 units": - ✔✔SELECT PRODNAME
FROM SALESPERSON, PRODUCT, SALES
WHERE SALESPERSON.SPNUM=SALES.SPNUM
AND SALES.PRODNUM=PRODUCT.PRODNUM
AND SPNAME='Adams'
AND QUANTITY>2000;
✔✔CREATE TABLE command - ✔✔The command that creates base tables and tells
the system what attributes will be in them.
✔✔CREATE VIEW command - ✔✔Specifies the base tables on which the view is to be
based and the attributes and rows of the table that are to be included in the view.
✔✔DELETE command - ✔✔Specify which row(s) of a table are to be deleted based on
data values within those rows.
✔✔DROP TABLE command - ✔✔Discards an entire table from a database.
✔✔DROP VIEW command - ✔✔Discards views.
✔✔Normalization - ✔✔The process of organizing the fields and tables of a relational
database to minimize redundancy (duplication) and dependency.
✔✔Second Normal Form - ✔✔All non-key attributes must be functionally dependent on
the entire key of that table.
✔✔Third Normal Form - ✔✔Non-key attributes are not allowed to define other non-key
attributes.
, ✔✔What are three important points about Third Normal Form? - ✔✔1. It is completely
free of redundancy
2. All foreign keys appear where needed to logically tie together related tables.
3. It is the same structure that would have been derived from a properly drawn entity-
relationship diagram of the same business environment.
✔✔Write the SQL query to "Add a new salesperson into the SALESPERSON table
whose salesperson number is 489, name is Quinlan, commission percentage is 15, year
of hire is 2011, and department number is 59.": - ✔✔INSERT INTO SALESPERSON
VALUES
('489','Quinlan',15,'2011','59');
*Hint, this is DML, so remember that INSERT is one of the keywords for DML.
✔✔Write the SQL query to "Delete the row for salesperson 186 from the
SALESPERSON table.": - ✔✔DELETE FROM SALESPERSON
WHERE SPNUM = '186';
✔✔What is the correct syntax of the INSERT command? - ✔✔INSERT INTO
table_name VALUES (value1,value2,value3,...):
✔✔What is the correct syntax of the CREATE VIEW command? - ✔✔CREATE VIEW
view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
✔✔What is called a decomposition process? - ✔✔Data normalization
✔✔In which of the normal forms should every non-key attribute be fully functionally
dependent on the entire key of a table? - ✔✔Second form
✔✔What is the correct syntax of the CREATE TABLE command? - ✔✔CREATE TABLE
table_name (
column_name data_type(size),
);
✔✔What is the correct syntax of the UPDATE command? - ✔✔UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
✔✔Association Rules - ✔✔Association rules specify a relation between attributes that
appears more frequently than expected if the attributes were independent.