You are on page 1of 4

Ramon Magsaysay Memorial College

LABORATORY EXERCISE
FIRST SEMESTER: AY: 2021 – 2022

Name: Rheny Jay Q. Bondoc Schedule: __ Score: ________


Subject: INFORMATION MANAGEMENT 1 Instructor: __JIM JAMERO___ Date: 05/31/2022
LABORATORY EXERCISE
SQL 1

Learning Objectives
 To understand how to create a database and tables.
 To identify the roles of tables and fields.
 To know how to create and drop a database or table.

Prerequisite student experiences and knowledge


Database management has evolved from a specialized computer application to a central component
of a modern computing environment. As a result, knowledge about database systems has become an
essential part of computer science.

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 SQL
4. Type SQL Script
CREATE DATABASE IntroSQL;
5. Then, select IntroSQL and select SQL
6. Type SQL script for tbl_user
CREATE TABLE IF NOT EXISTS tbl_user (
user_id INT AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
FIRST SEMESTER: AY: 2021 – 2022

Name: Rheny Jay Q. Bondoc Schedule: __ Score: ________


Subject: INFORMATION MANAGEMENT 1 Instructor: __JIM JAMERO___ Date: 05/31/2022
password VARCHAR(255) NOT NULL,
reg_date DATE,
PRIMARY KEY (user_id)
);

CREATE TABLE IF NOT EXISTS tbl_product (


prod_id INT AUTO_INCREMENT,
prd_name VARCHAR(128) NOT NULL,
quantity INTEGER(11) NOT NULL,
retail_price DOUBLE(10,2) NOT NULL,
selling_price DOUBLE(10,2) NOT NULL,
reg_date DATE,
PRIMARY KEY (user_id)
);

7. If you encounter the Error, then fix the Error


8. Display the result.
9. Print the result on the page provided.
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
FIRST SEMESTER: AY: 2021 – 2022

Name: Rheny Jay Q. Bondoc Schedule: __ Score: ________


Subject: INFORMATION MANAGEMENT 1 Instructor: __JIM JAMERO___ Date: 05/31/2022
QUESTIONS

1. What SQL script did you use to create a table ?


CREATE TABLE IF NOT EXISTS tbl_user (
user_id INT AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
reg_date DATE,
PRIMARY KEY (user_id)
);

2. Run the script below. What happens to the script that you implement?
DROP TABLE tbl_product;

The table that I created has been deleted.

3. Did you encounter an error in the syntax? How did you fix it? Show the previous SQL
script, and fix the SQL script.
I encounter a wrong name or mistype variable in the db_conn.php and I retype it with
the correct spelling of the variable.
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
FIRST SEMESTER: AY: 2021 – 2022

Name: Rheny Jay Q. Bondoc Schedule: __ Score: ________


Subject: INFORMATION MANAGEMENT 1 Instructor: __JIM JAMERO___ Date: 05/31/2022
Output / Results

Conclusion

The xampp software is user friendly to use because when I insert some data to the table I simply
click the insert and put the data in it.

You might also like