LABORATORY EXERCISE 4 Prince Joseph Sales
LABORATORY EXERCISE 4 Prince Joseph Sales
LABORATORY EXERCISE 4 Prince Joseph Sales
LABORATORY EXERCISE
____ SEMESTER: AY: _________
LABORATORY EXERCISE 4
SQL JOINS
Learning Objectives
To visualize and understand the SQL JOINS script.
To determine the importance of JOINS and handling data.
Background
SQL (Structured Query Language) is a nonprocedural language, and you specify what
you want, not how to get it. A block-structured format of English keywords uses in this Query
language. It has the following components. The SQL DDL (Data Definition Language) provides a
command for defining relation schemas, deleting relations, and modifying relation schema.
DML (Data Manipulation Language) includes commands to insert tuples into, delete tuples
from and modify tuples in the Database. Embedded and Dynamic SQL define how SQL
statements can embed within general-purpose programming languages, such as C, C++, JAVA,
COBOL, Pascal, and Fortran.
Materials/Resources
PC/Internet
Pen
MySQL (Xampp, Wampp & MySQL)
Web Browser (Internet Explorer, Mozilla, Google Chrome, Etc.)
Word-processing program
Laboratory Activity
Instructions: Perform the following steps.
1. Open the program Xampp
2. Click the Start for Apache and MySQL
3. Then, click MySQL Admin
4. Select Database, then click the Database created on laboratory exercise 1/2
5. Select the SQL menu, then
6. Type
CREATE TABLE Bus_Company ( Company_ID int,Company varchar(128), Bus_No
int(15));
8. Select SQL menu, then type "SELECT * FROM bus CROSS JOIN Bus_Company."
9. If you encounter the Error, then fix the Error
10. Display the result.
11. Print the result on the page provided.
QUESTIONS
1. What is the result of "SELECT * FROM bus CROSS JOIN Bus_Company"? Explain the
result.
- The result in Cross join bus company is that all tables that were created in Bus and
Bus_company were added into one table.
2. Base on the resulting syntax below? What is the result of this syntax? How the data
process and show the result? How did you fix it if you encounter Error?
SELECT company_id, company, bus_number FROM bus CROSS JOIN where
company=Husky
- The result of the syntax shows all bus company with the Bus named “husky”.
The error in this code is the company_id, company, bus_number and I just removed
it and run the syntax
Output / Results
Conclusion
In this activity it shows you how to create a new table and do the cross join syntax in
the two tables and finding a specific bus name.