Introduction
A database is an organized collection of data stored electronically to help users easily store, manage, and
retrieve information. Databases are essential in today’s digital world because they enable efficient handling
of large amounts of data securely and reliably. SQL, or Structured Query Language, is the standard
language used to communicate with databases, allowing users to create, read, update, and delete data.
Within a database, data is organized into tables, which consist of rows and columns; each row represents
a record, and each column represents an attribute or field of the data. In this lab, we will learn about these
fundamental concepts and practice working with databases using XAMPP and phpMyAdmin.XAMPP
Installation Guide
Objective
• Understand what a database is and why it is important.
• Learn about SQL and its basic commands.
• Learn how to install and start XAMPP.
• Practice creating, showing, and deleting databases and tables using phpMyAdmin.
• Learn to insert data into tables and display the results.
Installation of XAMPP
What is XAMPP?
XAMPP is a free software package that includes Apache server, MySQL database, PHP, and
Perl, allowing developers to run a local web server on their computers.
How to Install XAMPP:
1. Download XAMPP from the official website (https://www.apachefriends.org).
2. Run the installer and follow the setup instructions.
3. After installation, open the XAMPP Control Panel.
How to Start XAMPP:
• Open the Control Panel.
• Start the Apache server and MySQL service by clicking the 'Start' button beside each
module.
• Open your browser and go to http://localhost/phpmyadmin to access phpMyAdmin, a web
interface for managing databases.
Writing SQL Code in phpMyAdmin
phpMyAdmin provides a user-friendly interface where you can write and execute SQL queries
directly to manage your databases and tables.
Creating the Employee Database and Table
Let's create a database named Employee where we can store the following information about
employees:
• Employee ID
• Name
• Job Name
• Manager
• Hire Date
• Salary
• Commission
• Department ID
Step 1: Create Database
SQL Syntax:
Uses of Syntax:
• CREATE: This keyword is used to create a new database or other database objects like
tables, indexes, etc.
• DATABASE: Specifies that a new database is to be created.
• Employee: The name of the database you want to create.
Now run it by click on Go
Output:
Step 2: Show Existing Databases
SQL Syntax:
Uses of Syntax:
• SHOW: This keyword is used to display information about databases, tables, or other
database objects.
• DATABASES: Specifies that the list of all databases on the server should be displayed.
Output:
Step 3: Delete a Database
SQL Syntax:
Uses of Syntax:
• DROP: This keyword is used to delete an existing database or other database objects
permanently.
• DATABASE: Specifies that a database will be dropped (deleted).
• Employee: The name of the database to be deleted.
Output:
There is no database of employee.
Step 4: Create Table employee_info
SQL Syntax:
Uses of Syntax:
• CREATE TABLE: Creates a new table.
• BIGINT: Stores large whole numbers (up to 8 bytes).
• VARCHAR (255): Stores text up to 255 characters.
• DATE: Stores date in YYYY-MM-DD format.
• DECIMAL (10,2): Number with up to 10 digits total, 2 after decimal (e.g., 99999999.99).
Output:
Step 5: Insert Data into Table
SQL Syntax:
Uses of Syntax:
• INSERT INTO: Command to add new records (rows) into a table.
• employee_info: Name of the table to insert data into.
• (Column list): Specifies the columns for which data will be provided.
• VALUES: Keyword indicating the start of the data values to insert.
• (…): The actual data to insert into the corresponding columns.
Output:
Notepad Code:
Discussion
We explored the essential concepts of databases, understanding their importance in organizing and
managing large amounts of data efficiently. The role of SQL was studied as the standard language
for interacting with databases through commands such as CREATE, SHOW, DROP, and INSERT.
Installation and setup of XAMPP provided a local environment to work with MySQL and PHP.
Creating the Employee database and its table, along with inserting data, demonstrated how data is
structured in tables and how SQL commands control that data effectively.
Conclusion
The knowledge gained about database creation and management equips us with practical skills
necessary for many real-world applications. Databases play a vital role in systems like employee
records, inventory management, customer relationship management, and web-based applications.
Mastering SQL commands and database operations enables the development of efficient, scalable
software solutions. These foundational skills will support future work in software development,
data analysis, and information systems management.