Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 17 pages
Other

DAD-220 Module 3 Lab Submission

Document preview thumbnail
Preview 3 out of 17 pages

Completed Lab submission with source code and screenshots for references.

Content preview

Module Three Lab Three: Table Joins
1.In this lab, we continue working with our database we established in module 1 and furthered in module 2. Our goal is to practice the applications of JOIN clauses. We must change our file permissions through the shell script provided. The ‘chmod +x’ makes ‘change_perm.sh’ change the permissions on itself to make it executable as a program. And the ./change_perm.sh executes the script. Then we launch MySQL as usual by entering ‘mysql’ and pressing Enter.
Continuing we connect to the established database
USE delehant
and perform a SELECT Statement to verify we have connected to the right information.
SELECT * FROM Employee; 2.My next task was updating the “Branches” table name to match the chosen name of “Department” for this assignment. The assigned method of doing this is through an ALTER/RENAME statement.
ALTER TABLE Branches
RENAME TO Department;
3.With the Department table newly named, I then set about adding fields to the empty table. Without this, we would be unable to perform the necessary joins to satisfy the proper output.
a.To add our data, we will be using an INSERT statement. In this instance, the code is already provided.
INSERT INTO Department VALUES (1, 'Accounting'), (2, 'Human Resources'), (3, 'Information Systems'), (4, 'Marketing');
b.I then validate by a SELECT statement to check the table results. SELECT * FROM Department;
4.With our tables populated, we look to create joins between the Department and Employee
tables. Using our SELECT statement, it will join records of Departmet_Name with the first and last names of the employees that belong to each corresponding Department_ID we select. a.Starting with Department 1 = Accounting.
SELECT First_Name, Last_Name, Department.Department_Name FROM Employee INNER JOIN Department ON Employee.Department_ID = Department.Department_ID WHERE Employee.Department_ID = 1; b.Someone once said a good programmer is a lazy programmer. Not sure if I agree, but copy and paste can be practical if used with diligence. Identical select statements will work moving forward by simply changing Department_ID = to the corresponding number. Department 2 = Human Resources
SELECT First_Name, Last_Name, Department.Department_Name

Document information

Uploaded on
March 14, 2021
Number of pages
17
Written in
2020/2021
Type
Other
Person
Unknown
$5.98
Purchased by 14 students

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Riveneye
4.2
(66)
Sold
383
Followers
225
Items
51
Last sold
3 months ago

Reviews from verified buyers




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions