Download presentation
Presentation is loading. Please wait.
1
Web Design and Development
Lecture # 06 Instructor: Rida Noor Department of Computer Science
2
Structured Query Language
* 07/16/96 What is SQL? Structured Query Language (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
3
What is SQL? SQL allows you to access a database
* 07/16/96 What is SQL? SQL allows you to access a database SQL is an ANSI standard computer language SQL can execute queries against a database SQL can retrieve data from a database SQL can insert new records in a database SQL can delete records from a database SQL can update records in a database SQL is easy to learn (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
4
* 07/16/96 Working on WAMP You save your all Projects in C:\wamp\www\myWebsite( Your folder name) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
5
* 07/16/96 Working on WAMP All your HTLM, CSS and PHP file reside inside your folder in my case myWebsite( Your folder name) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
6
Working on WAMP Write localhost in browser and press enter. * 07/16/96
(c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
7
* 07/16/96 Working on WAMP (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
8
* Working on WAMP 07/16/96 (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
9
Create a Database Start services.
* 07/16/96 Start services. Click on localhost tab from system tray. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
10
* 07/16/96 Working on WAMP Click on phpmyadmin to open this interface. Here resides your databases. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
11
* 07/16/96 Working on WAMP Click on phpmyadmin to open this interface. Here your resides your databases. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
12
* 07/16/96 Create Database Give any name to your database that you want to create and press Create button. I named my database db_myWebsite. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
13
* 07/16/96 Delete Database To delete any database select relevant checkbox and click on drop icon . (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
14
Delete Database Now press yes or no according to your choice. *
07/16/96 Delete Database Now press yes or no according to your choice. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
15
* 07/16/96 Created Database To create tables in you database, click on database that you have created for example db_mywebsite. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
16
Create Table in Database
* 07/16/96 To create table in database. Write table name for example tbl_registration and number of field for example 6. Press Go. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
17
Create Fields of Table * 07/16/96 Write the field names, each field type, Length/Value the type needs according to your requirement. Default values are optional . (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
18
Create Fields of Table * 07/16/96 We make tbl_id auto_inreament by selecting A_I that is the index in each table. So that it increment automatically as we add new record. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
19
Save or Add Fields * 07/16/96 After entering fields press save to save your table. You may also add rows by entering number of rows and pressing GO button. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
20
Insert Record * 07/16/96 To insert any record click on insert, enter values and press go. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
21
Inserted Record * 07/16/96 You will get message, either your record inserted successfully or not. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
22
Inserted Record * 07/16/96 In the left pannel you can see your tables that you have created. Click on you relevant table to see the record you entered in that table. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
23
Edit or Delete Record Here you can edit and delete record. * 07/16/96
(c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
24
SQL Select The SELECT statement is used to select data from a table.
* 07/16/96 The SELECT statement is used to select data from a table. Select all rows/records SELECT * FROM `tbl_registration`; Select particular field SELECT fld_ FROM `tbl_registration`; Select more than one fileds SELECT fld_ , fld_firstname FROM `tbl_registration`; (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
25
SQL where Select Record with where clause
* 07/16/96 SQL where Select Record with where clause To conditionally select data from a table, a WHERE clause can be added to the SELECT statement. SELECT * FROM `tbl_registration` WHERE fld_firstname = 'TOM‘; SELECT * FROM `tbl_registration` WHERE fld_reg_id =1; (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
26
SQL Insert Insert Record
* 07/16/96 SQL Insert Insert Record The INSERT INTO statement is used to insert new rows into a table. INSERT INTO `tbl_registration` (`fld_ `, `fld_password`,`fld_firstname`,`fld_lastname`, `fld_date`) VALUES 'abc123', 'hazel', 'chang', CURRENT_TIMESTAMP); (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
27
SQL Update Update record
* 07/16/96 Update record We want to update a first name to the person with a first name of " 'Hazel ": UPDATE `tbl_registration` SET fld_firstname='Johny' WHERE fld_firstname='Hazel'; SET fld_firstname='Hazel', fld_lastname='Tom' WHERE fld_firstname='Johny‘; (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
28
SQL Delete Delete record
* 07/16/96 Delete record The DELETE statement is used to delete rows in a table Delete all Records DELETE FROM `tbl_registration`; Delete particular Record DELETE FROM `tbl_registration` WHERE fld_firstname='Hazel‘ AND fld_lastname='Tom'; (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
29
THANK YOU
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.