logo

Database Design and SQL

29 Pages3169 Words92 Views
   

Added on  2022-12-18

About This Document

This document provides a comprehensive guide on database design and SQL. It covers topics such as ERD diagram development, connecting to databases, creating tables, inserting data, and executing queries. The document also includes a dataset analysis and the creation of forms in MS-Access.

Database Design and SQL

   Added on 2022-12-18

ShareRelated Documents
Running head: DATABASE DESIGN AND SQL
Database design and SQL
Name of the Student
Name of the University
Authors note
Database Design and SQL_1
DATABASE DESIGN AND SQL
1
Part 1
Developed ERD Diagram
Database Design and SQL_2
DATABASE DESIGN AND SQL
2
Task 1
Connecting to the database from Mysql Work bench
Creating and connecting database
Customer table
CREATE TABLE `salesmarketingdb`.`customer` (
Database Design and SQL_3
DATABASE DESIGN AND SQL
3
`customernumber` INT NOT NULL AUTO_INCREMENT,
`customername` VARCHAR(45) NOT NULL,
`customeraddress` VARCHAR(70) NOT NULL,
`customercity` VARCHAR(45) NOT NULL,
`customerzip` VARCHAR(15) NOT NULL,
`customercontact` VARCHAR(45) NOT NULL,
`customercol` VARCHAR(45) NOT NULL,
PRIMARY KEY (`customernumber`));
Product table
CREATE TABLE `salesmarketingdb`.`product` (
Database Design and SQL_4
DATABASE DESIGN AND SQL
4
`productid` INT NOT NULL AUTO_INCREMENT,
`productname` VARCHAR(45) NOT NULL,
`productdesc` VARCHAR(50) NOT NULL,
`productprice` VARCHAR(45) NOT NULL,
`productcategory` VARCHAR(20) NOT NULL,
PRIMARY KEY (`productid`));
Sales table
CREATE TABLE `salesmarketingdb`.`salestable` (
`idsales` INT(11) NOT NULL,
`customernumber` INT(11) NOT NULL,
`productid` INT(11) NOT NULL,
`salesquantity` INT NOT NULL,
Database Design and SQL_5
DATABASE DESIGN AND SQL
5
`salesamont` INT NOT NULL,
`salesdate` DATE NOT NULL,
PRIMARY KEY (`idsales`));
Delivery table
CREATE TABLE `salesmarketingdb`.`delivery` (
`iddelivery` INT NOT NULL AUTO_INCREMENT,
`deliveryaddress` VARCHAR(75) NOT NULL,
`deliveryzip` VARCHAR(15) NOT NULL,
`customerid` INT(11) NOT NULL,
`deliverymethod` VARCHAR(45) NOT NULL,
PRIMARY KEY (`iddelivery`));
Adding foreign key relationship
Database Design and SQL_6

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Business Data Management and Analytics Assignment 2022
|10
|1141
|5

Database Management System
|19
|2055
|397

Task 1 CREATE TABLE EMPDB
|7
|1224
|62

SQL queries for creating and manipulating tables in a database
|12
|1173
|184

Business Information Systems Solved Assignment
|15
|1095
|122

Creating Database and Tables in TufftoysDB
|10
|1652
|27