Write SQL code for the following design schema of three tables. The tables should have the following properties: sales table has a primary key on SalesNumber and it is set to AUTO-INCREMENT. products table has a primary key on number and it is set to AUTO-INCREMENT, they is an unique index on prodid salesdetails table has a primary key on number and it is set to AUTO-INCREMENT, they is an index on prodid. They is a one-to-many relationship between the salesdetails.SalesNumber and sales.SalesNumber fields. There is a one-to-many relationship between the products.prodid and salesdetails.prodid fields. There is to be a delete constraint on the product.prodid field a record in the product table should not be allowed to be deleted if they exist a matching prodid in the salesdetails table. Primary and foreign keys should be implemented in the appropriate tables. Referential Integrity should be enforce at the database level, where appropriate for example, if a sales record is deleted all associated records in the saledetails table should be deleted as well, etc.
Write SQL code for the following design schema of three tables. The tables should have the following properties:
sales table has a primary key on SalesNumber and it is set to AUTO-INCREMENT.
products table has a primary key on number and it is set to AUTO-INCREMENT, they is an unique index on prodid
salesdetails table has a primary key on number and it is set to AUTO-INCREMENT, they is an index on prodid.
They is a one-to-many relationship between the salesdetails.SalesNumber and
sales.SalesNumber fields.
There is a one-to-many relationship between the products.prodid and salesdetails.prodid fields.
There is to be a delete constraint on the product.prodid field a record in the product table should not be allowed to be deleted if they exist a matching prodid in the salesdetails table.
Primary and foreign keys should be implemented in the appropriate tables.
Referential Integrity should be enforce at the


Step by step
Solved in 4 steps









