Question

In: Computer Science

For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name,...

For the given database schema. Answer the following questions.

Company Database customer(cust_id, name, address)

product(product_id, product_name, price, quantity)

transaction(trans_id, cust_id, time_date)

product_trans(product_id, trans_id)

Identify the primary keys and foreign keys for the relations and specify at least two different types of integrity constraints that would be applicable for different relations given.

Solutions

Expert Solution

given the following relations

1) customer(cust_id, name, address)

          - > primary key is cust_id

2) product(product_id, product_name, price, quantity)

          - > primary key is product_id

3) transaction(trans_id, cust_id, time_date)

           - > primary key is trans_id

        -> foreign key is cust_id referencing cust_id of relation customer

4) product_trans(product_id, trans_id)

           -> primary key is trans_id +product_id , it s a composit key

           -> both are foreign keys

                        foreign key 1 is, trans_id referencing trans_id of relation transaction

                        foreign key 2 is, product_id referencing product_id of relation product

------------------------------------------------------------------------

different integrity constraints applcable on the above relation are

1. Domain constraints ( definition of valid set of value for an attribute eg:- int , char , .... datatype )

2. Entity integrity constraints ( primary key value can't be null. )

3. Referential Integrity Constraints ( foreign keys can be used )

4.Key constraints( A primary key should contain unique value)

                    


Related Solutions

Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone Email 9087 John Doe 204 University Ave. 987-098-9087 [email protected] 2098 Bill Lawrence 123 Jones St 717-387-3387 Business 2398 Laura Smith 0900 West Blvd. 901-234-4567 Information Transactions Customer ID Account Number Date of Last Transaction 9087 375 01/31/98 2098 123 03/09/97 2398 375 09/21/97 2098 375 12/31/97 2398 123 02/01/98 Accounts Account Number Balance Account Type 375 234.45 Checking 123 056.90 Savings 1. Who owns...
The schema for the Academics database is as follows. Understanding this schema is necessary to answer...
The schema for the Academics database is as follows. Understanding this schema is necessary to answer the questions in Part B. DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) The semantics of most attributes are self-explanatory. For each relation, the primary key is underlined and any foreign keys are denoted by an asterisk (*). Some additional information for relations is given below: DEPARTMENT: Each academic department...
Consider the following database schema:                Product(maker, model, type)                PC(model, speed
Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Give SQL statement for each of the following: (Grouping and Aggregation) Write the following queries in SQL: Find the average speed of laptops costing over $2000. Find the average price of PC’s and laptops made by manufacturer “D”. Find, for each manufacturer, the average screen size of its laptops. Find the manufacturers...
Consider the following database schema:                Product(maker, model, type)                PC(model, speed
Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Give SQL statement for each of the following: (Subqueries, Join operations) Write the following queries in SQL: Find the makers of PC’s with a speed of at least 1200. Find the printers with the highest price. Find the laptops whose speed is lower than that of any PC. Find the model number...
SQL query exercises: Consider the following database schema:                Product(maker, model, type)              &
SQL query exercises: Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Consider the Drivers-Cars-Reserves DB for a small rental car company:                Drivers(id, name, rating, age)                Cars(vin, maker, model, year, color)                Reserves(did, vin, date) Give SQL statement each of the following operations: Find the colors of cars reserved by Smith. Find all id’s of drivers who have a...
All questions in this assignment refer to the “om” database (or Schema) that you will find...
All questions in this assignment refer to the “om” database (or Schema) that you will find in your MySQL Workbench program if you have run the sample database install script. Please save all of your answers in one script (.sql) or type all your answers into Notepad++ and submit them as a single .sql file. You are encouraged to test your SQL statements in Workbench, and please use the ‘tidy’ tool to properly format your SQL before you save it...
using the lyrics database schema in mysql provided below. 1.)List the artist name of the artists...
using the lyrics database schema in mysql provided below. 1.)List the artist name of the artists who do not have a webaddress and their leadsource is “Directmail”? 2.)List the names of members in the artist called 'Today'. 3.)Report the total runtime in minutes FOR EACH album in the Titles table. 4.)List the firstname, lastname of members who are represented by the salesperson “Lisa Williams” 5.)List EACH salesperson’s firstname along with the number of Members that EACH SalesPerson represents. below is...
Given the following 7 relations: MIScompany (name, address, phone, email, FedTaxId, StaTaxId) branch (branchId, name, address,...
Given the following 7 relations: MIScompany (name, address, phone, email, FedTaxId, StaTaxId) branch (branchId, name, address, phone, email, FedTaxId, StaTaxId) employee (empId, driverId, ssno, name, branchId) customer (custId, name, address, driverId, ssno, FedTaxId, StaTaxId) equipment (equipId, name, type, upc, purchaseDate, year, manufacturId, cost, rentFee, branchId ) manufacturer (manufacturId, name, FedTaxId, StaTaxId, phone, email) rental (rentalId, equipId, custId, rentDate&time, returnDate&time, empId) Use relational algebra to retrieve every customer that has not rented any equipment in September 2020. The report should contain...
please answer these questions about amazon in one short essay organization name and address type of...
please answer these questions about amazon in one short essay organization name and address type of organization and company background ( brief history of the company ) company Mission and what are their objectives
Consider the STAR schema with dimensions Customer, Product, and Time. The fact table has a measure...
Consider the STAR schema with dimensions Customer, Product, and Time. The fact table has a measure called Purchase_Price. This measure is: - additive -non-additive -semi-additive
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT