Mark Felisilda CMPS 3680 - Lab 9 1. An RDBMS is a Relational Database Management System. 2. A database schema is a database's structure described in formal language. It is similar to a blueprint of the database. 3. An ER Model is an Entity Relationship Model. It describes the database in a graphical form and is usually used to explain a database to those without technical knowledge. 4. A one-to-one relationship means that a row in one table can only relate to one row in the table on the other side of the relationship. 5. A one-to-many relationship means that a row in one table can relate to many rows in the table on the other side of the relationship. 6. A many-to-many relationship means that many rows in one table can relate to many rows in the table on the other side of the relationship. For example, a book may have many authors, and an author may write many books. 7. A tuple is a single row of a table which contains a single record for a relation. 8. A primary key is a key that is unique for each record (for example an ID number). A relational database must only have one primary key per entity. 9. Primary keys should be unique so that entries in the database can be identified. 10. SQL is a standard language for storing, manipulating, and retrieving data in databases. 11. CREATE TABLE Customers ( c_id int(10) unsigned NOT NULL AUTO_INCREMENT, c_firstName varchar(255) DEFAULT NULL, c_lastName varchar(255) DEFAULT NULL, c_address varchar(255) DEFAULT NULL, c_city varchar(255) DEFAULT NULL, c_zip int(10) unsigned DEFAULT NULL, c_email varchar(255) DEFAULT NULL ); 12. ALTER TABLE Customers ADD c_age unsigned tiny int; 13. CREATE TABLE Products ( p_id int(10) unsigned NOT NULL AUTO INCREMENT, p_title varchar(255) DEFAULT NULL, p_description varchar(255) DEFAULT NULL, p_price decimal(13,4) DEFAULT NULL ); 14. INSERT INTO Customers VALUES ( '1', 'Bob', 'Jones', '123 Street St', 'Bakersfield', '93311', 'bob@jones.com' ), ( '2' 'John', 'Roberts', '124 Street St', 'Bakersfield' '93311' 'johnroberts69@hotmail.com' ), ( '3', 'Steve', 'Stevens', '125 Street St', 'Bakersfield', '93311', 'steveiscool@coolsteve.net' ); 15. INSERT INTO Products VALUES ( '1', 'Banana', 'This is a banana', '1.99' ), ( '2', 'Apple', 'This is an apple', '2.99' ), ( '3', 'Orange', 'This is an orange', '47.99' ); 16. CREATE TABLE Orders ( o_id int(10) unsigned NOT NULL AUTO INCREMENT, o_cid int, o_amount decimal(13,4), o_date datetime ); 17. INSERT INTO Orders VALUES ( '1', '1', '1', '1999-12-12 12:12:12' ), ( '2', '2', '2', '1999-11-11 11:11:11' ), ( '3', '3', '3', '1999-10-10 10:10:10' ); 18. SELECT * FROM Customers 19. SELECT * FROM Products 20. UPDATE Products SET p_price '49.99' WHERE p_id = '1'; 21. SELECT * FROM Products WHERE p_price < 100.00; 22. SELECT * FROM Orders WHERE o_cid = 3; 23. SELECT * FROM Orders WHERE o_amount > 100.00; 24. DELETE FROM Products WHERE ORDER BY p_id LIMIT 1; 25. DROP TABLE DropThisTable_GoneForever;