Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In SQL create a CUSTOMER database. The purpose of the database is to store and retrieve customer personal information and customer purchase information. The personal

In SQL create a CUSTOMER database. The purpose of the database is to store and retrieve customer personal information and customer purchase information. The personal information includes CUSTOMER ID, CID, last name, CLNAME, first name, CFNAME, address, CADDRESS, and phone, CPHONE, ethnicity, CETHNICITY and PID. Both CID and PID are primary keys and PID is a foreign key in this table. The purchase information includes purchase date, PDATE, product ID, PID, product name, PNAME, and product price, PPRICE. PID is the primary key in this table. One product can be bought by many customers. One customer can buy many products. 1. Write down the different steps of developing this database. 2. Provide the ER diagram. 3. Create the tables, keys, and indices. 4. Write an SQL procedure and run it to insert 5 customer and product information in the 2 tables. 5. Write an SQL procedure and run it to display all customer information whose last name starts with Lop 6. Write an SQL procedure to retrieve all customer last names who purchased products on the same date. 7. Write an SQL function to retrieve all product names whose price is greater than 50. 8. Create an SQL trigger to stop any purchase records from deletion. 9. Create an SQL view to retrieve the product information which were bought by maximum number of customers.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions