0% found this document useful (0 votes)
59 views39 pages

Xampp

The document provides instructions for installing and using XAMPP, an open source web development environment. It explains that XAMPP allows developers to easily create a local web server for testing and accessing databases using phpMyAdmin. The document then demonstrates how to access phpMyAdmin, manipulate databases and tables within it, perform common operations like SELECT, INSERT, UPDATE and DELETE, and set up user permissions. It provides two examples of creating databases with related tables and performing various operations on them in phpMyAdmin.

Uploaded by

gulelat.atuu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views39 pages

Xampp

The document provides instructions for installing and using XAMPP, an open source web development environment. It explains that XAMPP allows developers to easily create a local web server for testing and accessing databases using phpMyAdmin. The document then demonstrates how to access phpMyAdmin, manipulate databases and tables within it, perform common operations like SELECT, INSERT, UPDATE and DELETE, and set up user permissions. It provides two examples of creating databases with related tables and performing various operations on them in phpMyAdmin.

Uploaded by

gulelat.atuu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

XAMPP Installation

XAMPP

•Simple, lightweight Apache distribution that makes it extremely easy for developers to create a
local web server for testing and deployment purposes.
•Allows you to visualize and manage your databases from your browser using the phpMyAdmin
application
XAMPP installation

URL: https://www.apachefriends.org/index.html
XAMPP installation
XAMPP installation
XAMPP installation
XAMPP installation
XAMPP installation
XAMPP installation
XAMPP installation
XAMPP Control Panel
XAMPP Control Panel
Accessing phpMyAdmin

•In your browser:


◦ http://localhost/phpmyadmin/

•phpMyAdmin is a database
management tool for MySQL
compatible databases.
Database manipulation in phpMyAdmin

•Using phpMyAdmin you can:


• Create databases
• Create tables
• Set relations between tables
• Access and manipulate data
Example 1

Database Name: Bookstore


Book (BookID, title, author, language, edition, price, publisherID)
Publisher (ID, Name, address )
Create a database
Create a table
Book table
Publisher table
Setting up relations
SELECT
INSERT
INSERT
DELETE
DELETE
UPDATE
UPDATE
Add a user to access the DB
Exercise 2

Database Name: WebProject


Teacher (ID, name, password)
Course (ID, Name, teacher, semester )
Create a database
Create a table

CREATE TABLE `webProject`.`teacher` ( `id` INT NOT NULL , `name`


VARCHAR(200) NOT NULL , `password` VARCHAR(200) NOT NULL ,
PRIMARY KEY (`id`)) ENGINE = InnoDB;

CREATE TABLE `webProject`.`course` ( `id` INT NOT NULL , `name`


VARCHAR(200) NOT NULL , `teacherID` INT NOT NULL , `semester`
VARCHAR(200) NOT NULL , PRIMARY KEY (`id`), INDEX (`teacher`))
ENGINE = InnoDB;
Setting up relation

ALTER TABLE `course` ADD FOREIGN KEY (`teacher`) REFERENCES `teacher`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
Add a user to access the DB

CREATE USER 'mywebProj'@'localhost' IDENTIFIED WITH mysql_native_password;GRANT USAGE ON *.* TO


'mywebProj'@'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;SET PASSWORD FOR 'mywebProj'@'localhost' = '***';GRANT ALL
PRIVILEGES ON `webProject`.* TO 'mywebProj'@'localhost';
Insert

INSERT INTO `teacher` (`id`, `name`, `password`) VALUES ('1', 'sadeem', '11111'), ('2', 'noura', ‘2222')

INSERT INTO `course` (`id` , `name`, `teacherID`, `semester`) VALUES ('1', 'swe381', '2', 'fall2016'), ('2', 'swe381', '2', 'spring2017'), ('3', 'swe481', '1', 'fall2016'), ('4', 'swe 481', '1',
'spring2017')
Select

What does this select statement do?

SELECT course.name FROM course INNER JOIN teacher ON teacher.id=course.teacherID and teacher.name='sadeem'
Delete

What does this delete statement do?

Delete from course where name='swe381' and semester='fall2016'


Drop

Dropping table course

Drop table course;


Evaluation

1. create tables of below database with the relation


Database Name: Restaurants
Restaurant (ID, name, license , owner)
Branch (ID, name, location, manager, phoneNo, restaurantID)
2. insert values ID name license owner
ID name location manager phoneNo restau
rantID
1 domino’s 12-435 James 1 King Fahad RdAl Murabba Omar 9200 00910 2
Monaghan
2 pizza hut 326-556 Dan Carney
2 Al Imam Ash Al Manar Ahmed 9200 00910 2
Shafii
3. select all branches of “pizza hut”
3 Umar Ibn Ar Rabwah Adam 9200 12345 1
4. delete “domino’s” restaurant Abdul Aziz

You might also like