SlideShare a Scribd company logo
1 of 19
CRUD in MySql 
By: Aimal Miakhel
Think of each table as a spreadsheet 
We define columns, also known as fields, 
which classify our data 
Each record in the table is a row
Varchar 
◦ Variable Characters, specify up to how many 
characters something will be 
Char 
◦ A set number of characters, good for things like 
state abbreviations 
Int 
◦ Whole numbers, positive or negative
Float 
◦ Floating Point, also known as a decimal 
Text 
◦ A huge blob of text, like a paragraph or more 
TinyInt / Bit / Boolean 
◦ 0 or 1, True or False 
DateTime 
◦ A date and time 0000-00-00 00:00:00
Depending on the flavor of SQL (Oracle, 
MySQL, MSSQL, PostgreSQL, etc) there are 
many more 
Don’t get overwhelmed, just think of what 
will be best in terms of sorting and lookups
Creating Table in Mysql 
CREATE TABLE User 
( 
ID int, 
Username varchar(255), 
Password varchar(255) 
);
Username 
◦ Varchar 
Password 
◦ Varchar 
ID 
◦ Integer 
AccountCreated 
◦ DateTime
ID UserNa 
me 
Passwo 
rd 
1 John 123 
2 Jane 334 
3 Sally 567 
4 Ryan 8675 
5 Joe 90887 
9 
User _Table
Create 
Read 
Update 
Delete
INSERT is used to create a new record in the 
database 
For example user is a table 
INSERT into user VALUES (1,‘Aimal’, 
‘Miakhel’);
SELECT is used to retrieve a record in the 
database 
To select all the records from user table 
SELECT * FROM user;
Where is used for condition for some specific 
groups or records it filters the selection 
Eg. 
SELECT username, password FROM users 
WHERE ID = 1
UPDATE is used to change record(s) in the 
database 
UPDATE users SET username = ‘Ahmad’ 
WHERE ID = 1 
Or 
UPDATE users SET username = ‘Ahmad’ 
WHERE username = ‘Aimal’
DELETE is used to remove records from the 
database 
DELETE FROM users WHERE ID = 1 
** if you do not specify anything in the WHERE 
clause, it will delete everything in that table
SELECT User FROM Users WHERE ID IN (1,2) 
SELECT * FROM User 
WHERE Name IN (‘Ahmad',‘Ali');
SELECT User FROM Users WHERE ID BETWEEN 
3 AND 5 
SELECT * FROM User 
WHERE ID BETWEEN 3 AND 5;
WHERE can also use wildcards for text 
◦ WHERE Column IS LIKE ‘%something%’ 
WHERE can use more than = 
◦ WHERE ID < 4 
◦ WHERE ID <= 4 
WHERE can combine conditions 
◦ WHERE Column = ‘A’ AND Column2 = ‘B’ 
◦ WHERE Column = ‘A’ OR Column2 = ‘B’ 
◦ WHERE (Column = ‘A’ OR Column2 = B’) AND Other 
= ‘C’
SQL has functions, like COUNT and SUM 
SELECT Customer, SUM(Amount) FROM 
Orders GROUP BY Customer 
SELECT COUNT(Customer) FROM Orders 
GROUP BY Customer
Design a database for university students 
Contains 
Student registration 
Attendance 
Fees 
Etc 
Date-03-09-2014

More Related Content

What's hot

MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate FunctionsLeroy Blair
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An IntroductionManvendra Singh
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functionssinhacp
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - OperatorsWebStackAcademy
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)Sabana Maharjan
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScriptShahDhruv21
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptWalid Ashraf
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyshabab shihan
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - ObjectsWebStackAcademy
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced FunctionsWebStackAcademy
 

What's hot (20)

MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate Functions
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Javascript
JavascriptJavascript
Javascript
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easily
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 

Viewers also liked

Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEANMadhukara Phatak
 
Top 100 PHP Questions and Answers
Top 100 PHP Questions and AnswersTop 100 PHP Questions and Answers
Top 100 PHP Questions and Answersiimjobs and hirist
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSSimon Guest
 

Viewers also liked (7)

Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEAN
 
Top 100 PHP Questions and Answers
Top 100 PHP Questions and AnswersTop 100 PHP Questions and Answers
Top 100 PHP Questions and Answers
 
CodeIgniter 101 Tutorial
CodeIgniter 101 TutorialCodeIgniter 101 Tutorial
CodeIgniter 101 Tutorial
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
PHP - Introduction to PHP MySQL Joins and SQL Functions
PHP -  Introduction to PHP MySQL Joins and SQL FunctionsPHP -  Introduction to PHP MySQL Joins and SQL Functions
PHP - Introduction to PHP MySQL Joins and SQL Functions
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
 

Similar to Mysql Crud, Php Mysql, php, sql

Similar to Mysql Crud, Php Mysql, php, sql (20)

Sql
SqlSql
Sql
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
 
Database
Database Database
Database
 
Database Management System 1
Database Management System 1Database Management System 1
Database Management System 1
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
CVJ531: Intro to MySQL
CVJ531: Intro to MySQLCVJ531: Intro to MySQL
CVJ531: Intro to MySQL
 
06.01 sql select distinct
06.01 sql select distinct06.01 sql select distinct
06.01 sql select distinct
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
SQL
SQLSQL
SQL
 
Oracle SQL - Select Part -1 let's write some queries!
Oracle SQL - Select Part -1  let's write some queries!Oracle SQL - Select Part -1  let's write some queries!
Oracle SQL - Select Part -1 let's write some queries!
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
SQL
SQLSQL
SQL
 
SQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdfSQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdf
 
Lesson-02 (1).pptx
Lesson-02 (1).pptxLesson-02 (1).pptx
Lesson-02 (1).pptx
 
Oracle notes
Oracle notesOracle notes
Oracle notes
 
STRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGESTRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGE
 
Sql
SqlSql
Sql
 
Mysql
MysqlMysql
Mysql
 
Ankit
AnkitAnkit
Ankit
 

Recently uploaded

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 

Recently uploaded (20)

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 

Mysql Crud, Php Mysql, php, sql

  • 1. CRUD in MySql By: Aimal Miakhel
  • 2. Think of each table as a spreadsheet We define columns, also known as fields, which classify our data Each record in the table is a row
  • 3. Varchar ◦ Variable Characters, specify up to how many characters something will be Char ◦ A set number of characters, good for things like state abbreviations Int ◦ Whole numbers, positive or negative
  • 4. Float ◦ Floating Point, also known as a decimal Text ◦ A huge blob of text, like a paragraph or more TinyInt / Bit / Boolean ◦ 0 or 1, True or False DateTime ◦ A date and time 0000-00-00 00:00:00
  • 5. Depending on the flavor of SQL (Oracle, MySQL, MSSQL, PostgreSQL, etc) there are many more Don’t get overwhelmed, just think of what will be best in terms of sorting and lookups
  • 6. Creating Table in Mysql CREATE TABLE User ( ID int, Username varchar(255), Password varchar(255) );
  • 7. Username ◦ Varchar Password ◦ Varchar ID ◦ Integer AccountCreated ◦ DateTime
  • 8. ID UserNa me Passwo rd 1 John 123 2 Jane 334 3 Sally 567 4 Ryan 8675 5 Joe 90887 9 User _Table
  • 10. INSERT is used to create a new record in the database For example user is a table INSERT into user VALUES (1,‘Aimal’, ‘Miakhel’);
  • 11. SELECT is used to retrieve a record in the database To select all the records from user table SELECT * FROM user;
  • 12. Where is used for condition for some specific groups or records it filters the selection Eg. SELECT username, password FROM users WHERE ID = 1
  • 13. UPDATE is used to change record(s) in the database UPDATE users SET username = ‘Ahmad’ WHERE ID = 1 Or UPDATE users SET username = ‘Ahmad’ WHERE username = ‘Aimal’
  • 14. DELETE is used to remove records from the database DELETE FROM users WHERE ID = 1 ** if you do not specify anything in the WHERE clause, it will delete everything in that table
  • 15. SELECT User FROM Users WHERE ID IN (1,2) SELECT * FROM User WHERE Name IN (‘Ahmad',‘Ali');
  • 16. SELECT User FROM Users WHERE ID BETWEEN 3 AND 5 SELECT * FROM User WHERE ID BETWEEN 3 AND 5;
  • 17. WHERE can also use wildcards for text ◦ WHERE Column IS LIKE ‘%something%’ WHERE can use more than = ◦ WHERE ID < 4 ◦ WHERE ID <= 4 WHERE can combine conditions ◦ WHERE Column = ‘A’ AND Column2 = ‘B’ ◦ WHERE Column = ‘A’ OR Column2 = ‘B’ ◦ WHERE (Column = ‘A’ OR Column2 = B’) AND Other = ‘C’
  • 18. SQL has functions, like COUNT and SUM SELECT Customer, SUM(Amount) FROM Orders GROUP BY Customer SELECT COUNT(Customer) FROM Orders GROUP BY Customer
  • 19. Design a database for university students Contains Student registration Attendance Fees Etc Date-03-09-2014