Lab 1 Database
Lab 1 Database
LABORATORY EXERCISE
____ SEMESTER: AY: _________
Learning Objectives
Create tables and specify the questionnaires in SQL.
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
6. Select SQL then type “create table Bus (Bus_No varchar(5), source varchar(20), destination
varchar(20),CouchType varchar2(10),fair number);”
7. If you encounter the Error, then fix the Error
8. Display the result.
9. Print the result on the page provided.
QUESTIONS
2. Did you encounter Error in the syntax? How did you fix it? Show the previous SQL script, and
fix SQL script.
create table Bus (Bus_No varchar(5), source varchar(20), destination varchar(20),CouchType
varchar2(10),fairNumber int(20));
Output / Results
Conclusion
XAMPP is a cross-platform web server that is free and open-source. XAMPP is a short form for Cross-
Platform, Apache, MySQL, PHP, and Perl. XAMPP is a popular cross-platform web server that allows
Learning Objectives
To visualize and understand the SQL Select script.
To understand and analyze the SQL Insert Script.
To determine the importance of Insert and select 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
5. Select the SQL menu, then
6. Insert the data below by using this script” INSERT INTO TABLE_NAME (column1, column2,
column3,...columnN) VALUES (value1, value2, value3,...valueN);”
QUESTIONS
1. What is the result of "SELECT * FROM bus WHERE couch_type=LUXURY AND fair< 400"?
2. Base on the resulting syntax below? What is the result of this syntax? How the data process
and show the result?
INSERT INTO BUS(Bus_No, source, destination,CouchType,fair)
VALUES(BUS58,TACURONG,GENSAN,DELUXE,250.43);
SELECT * bus WHERE Bus_No=BUS58;".
Output / Results
Conclusion
Learning Objectives
To visualize and understand the SQL DELETE script.
To understand and analyze the SQL UPDATE Script.
To determine the importance of DELETE AND UPDATE 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
5. Select the SQL menu, then
6. Insert the data below:
QUESTIONS
1. What is the result of "DELETE * FROM bus WHERE Fair=400 AND"? Explain the result.
2. Base on the resulting syntax below? What is the result of this syntax? How the data process
and show the result? UPDATE BUS SET fere=’130' AND SET=destination=’Polomolok' Where
Bus_No=’BUS60'
Output / Results
Conclusion
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.
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
Output / Results
Conclusion
LABORATORY EXERCISE 5
SQL JOIN: LEFT, RIGHT, FULL, AND SELF JOIN
Learning Objectives
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_status (
Status_ID int,
Status varchar(68),
Bus_No int(15));
7. Insert data like sample below:
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 this SQL script "SELECT Bus_no, company_name FROM bus_status O
RIGHT JOIN bus C ON O.bus_nod = C.bus_no WHERE Status IS 'DAMAGE'"? Explain if you
encounter Error of the script and fix the Error?
2. What is the result of this SQL script? "SELECT SELECT Bus_no, compant_nameFROM
bus_status FROM bus C LEFT JOIN bus_status O ON O.bus_no = C.bus_no ORDER BY status '"?
Explain if you encounter Error of the script and fix the Error?
3. 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 B.bus_no AS busnum, B.fare AS fare, A.status AS status FROM Bus_status A,
Bus B WHERE A.bus_no <> B.bus_no ORDER BY A.bus_no
Output / Results
Conclusion
LABORATORY EXERCISE 6
LOGIN
Learning Objectives
To visualize and understand how to use SQL statement for user login.
To determine what SQL script use in implementing login or access form.
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
Programming Application (Visual Studio, Netbeans)
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 Users (
User_ID int(15) primary,
name char(128),
username char(64),
password char(64));
7. Insert data like the sample below:
9. Then build a syntax for the user can log in to the form
10. If the user login on the form, if the username and password inputted by the user have
existed in the table using the message will appear "Welcome!", hence incorrect the
message will appear "Username/Password Invalid."
11. Display the result.
12. Save and Print the result in the page provided.
QUESTIONS
2. What Error or problem did you encounter? And how did you resolve the issue?
Output / Results
Conclusion
LABORATORY EXERCISE 7
GUI: USER FORM (INSERT, DELETE, UPDATE, AND SEARCH/QUERY)
Learning Objectives
To demonstrate the SQL statement in PL, such as Visual Studio / Java.
To visualize and understand the role of the SQL statement in the Programming Languages.
To determine what SQL script used in implementing in User Form.
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
Programming Application (Visual Studio, Netbeans)
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. Then, open your program in Laboratory Exercise 6
6. Create a new form and name the form User_form
a. The form must have:
i. Three textboxes for (Name, username, and password)
ii. Button (insert, delete, edit, save, and exit)
iii. Search Textbox and button for display the query information
iv. Table for displaying the list of data from Database to GUI form.
b. Note: The form must have a validation.
7. Then build a syntax
8. Display the result.
9. Save and print the result on the page provided.
QUESTIONS
1. What parts of the process in developing the laboratory exercise 7 give you a problem? Why?
Output / Results
Conclusion
LABORATORY EXERCISE 8
GUI: BUS FORM (INSERT, DELETE, UPDATE AND SEARCH/QUERY)
Learning Objectives
To demonstrate the SQL statement in PL, such as Visual Studio / Java.
To visualize and understand the role of the SQL statement in the Programming Languages.
To determine what SQL script used in implementing in BUS Form.
Background
Materials/Resources
PC/Internet
Pen
Programming Application (Visual Studio, Netbeans)
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. Then, open your program in Laboratory Exercise 6
6. Create a new form and name the form Bus_form
a. The form must have:
i. A field that fits on the table of the bus
ii. Button (insert, delete, edit, save, and exit)
iii. Search Textbox and button for display the query information
iv. Table for displaying the list of data from Database to GUI form.
b. Note: The form must have a validation.
7. Then build a syntax
8. Display the result.
9. Save and print the result on the page provided.
QUESTIONS
1. What parts of the process in developing the laboratory exercise 8 give you a problem? Why?
Output / Results
Conclusion
LABORATORY EXERCISE 9
GUI: POSITION FORM (INSERT, DELETE, UPDATE, AND SEARCH/QUERY)
Learning Objectives
To demonstrate the SQL statement in PL, such as Visual Studio / Java.
To visualize and understand the role of the SQL statement in the Programming Languages.
To determine what SQL script used in implementing in BUS Form.
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
Materials/Resources
PC/Internet
Pen
Programming Application (Visual Studio, Netbeans)
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. Then, open your program in Laboratory Exercise 6
6. Create a new form and name the form Position form
a. The form must have:
i. A field that fits on the table of the Position
ii. Button (insert, delete, edit, save, and exit)
iii. Search Textbox and button for display the query information
iv. Table for displaying the list of data from Database to GUI form.
b. Note: The form must have a validation.
7. Then build a syntax
8. Display the result.
9. Save and Print the result in the page provided.
QUESTIONS
1. What parts of the process in developing the laboratory exercise 9 give you a problem? Why?
Output / Results
Conclusion
LABORATORY EXERCISE 10
GUI: BUS ASSIGNMENT FORM (INSERT, DELETE, UPDATE AND SEARCH/QUERY)
Learning Objectives
To demonstrate the SQL statement in PL, such as Visual Studio / Java.
To visualize and understand the role of the SQL statement in the Programming Languages.
To determine what SQL script used in implementing in BUS ASSIGNMENT Form.
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
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. Then, open your program in Laboratory Exercise 9
6. Create a new form and name the form Position form
a. The form must have:
i. A field that fits on the table of the Position
ii. Button (insert, delete, edit, save, and exit)
iii. Search Textbox and button for display the query information
iv. Table for displaying the list of data from Database to GUI form.
b. Note: The form must have a validation.
7. Then build a syntax
8. Display the result.
9. Save and print the result on the page provided.
QUESTIONS
1. What parts of the process in developing the laboratory exercise 10 give you a problem? Why?
Output / Results
Conclusion