It's time to build a database for an online shop!
- Install and configure a MySQL database server on a Virtual Machine, connect to it with the MySQL client.
- Fork this repository.
Edit the task.sql
file to create a SQL script for the online shop database. The script should complete the following actions on the database server:
- Create a database (schema) called
ShopDB
. - In the "ShopDB" database, create the following tables:
Products
, which has the following columns:ID
,Name
,Description
,Price
, andWarehouseAmount
.Customers
, which has the following columns:ID
,FirstName
,LastName
,Email
, andAddress
.Orders
, which has the following columns:ID
,CustomerID
, andDate
.OrderItems
, which has the following columns:ID
,OrderID
, andProductID
.
💡 When creating the tables, take the following into account:
- Use the appropriate data type for each column: `INT`, `DATE`, `VARCHAR(50)`, or `VARCHAR(100)`.
- Use autoincrement for the primary keys.
- Use construction `FOREIGN KEY (<column-name>) REFERENCES <referenced-table-name>(<referenced-column-name>) ON DELETE SET NULL` to connect related tables. The following tables are related: `Orders` and `Customers`, `OrderItems` and `Orders`, `OrderItems` and `Products`.
Just in case you want to test your script on your database before submitting a pull request, you can do it by performing the following actions:
- Run the script you wrote in the
task.sql
on your database server. - Make sure all tables in the database are empty.
- Run the
test.sql
script on your database. If the script execution is finished without errors, you are ready to submit a pull request.