Running Head: MILESTONE ONE
DAD-220 Milestone One
Christopher T. Gouchenouer
DAD-220 Introduction to SQL
Professor Robinson
7/15/2018
MILESTONE ONE
The first task that needed to be done was to create a database named hr.
mysql> CREATE database hr; Query OK, l row affected (o.oo sec)
Figure 1: Create database hr statement
I then implemented a use statement to change to the hr database.
Database changed mysql>
Figure 2: Use hr database statement
I was next tasked with creating a table titled person with columns named: person_id with the data
type being an integer, first_name with the data type being a VARCHAR limited to 25 characters,
last_name with the datatype being a VARCHAR limited to 25 characters, gender with the data
type being a VARCHAR limited to 1 character, age with the data type being an integer limited to
8 characters with the last being a column of my choice named phone_number with the data type
being a integer limited to 25 characters. There were constraints on the person_id, first_name and
last_name that must have data input. The person_id was the primary key with an auto increment
of 1.
PRIMAR
Figure 3: Person table created to include columns and constraints
MILESTONE ONE
The next step was to create a table titled department with columns named: dept_id with the data
type being an integer limited to 8 characters, dept_name with the data type being a VARCHAR
limited to 25 characters, building with the data being a VARCHAR limited to 25 characters and
the primary key being the dept_id column with an auto increment of 1. All columns must have
data.
nysq1> CREATE table department ( dept_id INT(8) UNSIGNED NOT NULl auto
building VARCHAR(25) NOT NULL, PRIMARY KEY (dept_id) >AUTO_INCREMENT=1; Query ok, o rows affected (o.oa sec)
Figure 4: Department table created to include columns and constraints
Next was to create a table called person department with columns titled person id and dept id.
These columns used an integer data type that must have data input. The primary key being used
were both the person_id and the dept_id.
mysql> CREATE table person_department ( > perSon_id INT(8) UNSIGNED NOT NULL, -> dept_id INT(8) UNSIGNED NOT NULL > PRIMARY KEY (person_id, dept_id) ); Query oK, o rows affected (o.o9 sec)
Figure 5: person_department table created with columns and constraints.