SlideShare a Scribd company logo
2
Most read
11
Most read
14
Most read
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 (20)

PDF
Javascript basics
shreesenthil
 
PPTX
Java script arrays
Frayosh Wadia
 
PPTX
Array in c#
Prem Kumar Badri
 
PPT
Constraints In Sql
Anurag
 
PPSX
Javascript variables and datatypes
Varun C M
 
PPTX
Introduction to SQL
Amin Choroomi
 
PPTX
Java script
Sadeek Mohammed
 
PDF
Sql tutorial
Rumman Ansari
 
PPT
SQL Queries
Nilt1234
 
PPT
Javascript arrays
Hassan Dar
 
PPTX
SQL commands
GirdharRatne
 
PDF
PL/SQL TRIGGERS
Lakshman Basnet
 
PPTX
Trigger in mysql
Prof.Nilesh Magar
 
PDF
Generics
Ravi_Kant_Sahu
 
PPTX
jQuery
Jay Poojara
 
PPT
Xml parsers
Manav Prasad
 
PPT
JavaScript: Events Handling
Yuriy Bezgachnyuk
 
PDF
JavaScript - Chapter 11 - Events
WebStackAcademy
 
Javascript basics
shreesenthil
 
Java script arrays
Frayosh Wadia
 
Array in c#
Prem Kumar Badri
 
Constraints In Sql
Anurag
 
Javascript variables and datatypes
Varun C M
 
Introduction to SQL
Amin Choroomi
 
Java script
Sadeek Mohammed
 
Sql tutorial
Rumman Ansari
 
SQL Queries
Nilt1234
 
Javascript arrays
Hassan Dar
 
SQL commands
GirdharRatne
 
PL/SQL TRIGGERS
Lakshman Basnet
 
Trigger in mysql
Prof.Nilesh Magar
 
Generics
Ravi_Kant_Sahu
 
jQuery
Jay Poojara
 
Xml parsers
Manav Prasad
 
JavaScript: Events Handling
Yuriy Bezgachnyuk
 
JavaScript - Chapter 11 - Events
WebStackAcademy
 

Viewers also liked (7)

PDF
Building RESTtful services in MEAN
Madhukara Phatak
 
PDF
Top 100 PHP Questions and Answers
iimjobs and hirist
 
PPTX
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
PPT
Codeigniter
minhrau111
 
PPT
PHP - Introduction to PHP MySQL Joins and SQL Functions
Vibrant Technologies & Computers
 
PDF
Javascript Best Practices
Christian Heilmann
 
PDF
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Building RESTtful services in MEAN
Madhukara Phatak
 
Top 100 PHP Questions and Answers
iimjobs and hirist
 
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
Codeigniter
minhrau111
 
PHP - Introduction to PHP MySQL Joins and SQL Functions
Vibrant Technologies & Computers
 
Javascript Best Practices
Christian Heilmann
 
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Ad

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

PPTX
CVJ531: Intro to MySQL
Clay Ewing
 
PPTX
sql.pptx
slavskrillex
 
PPT
Sql
jyothislides
 
PPTX
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
PPT
MY SQL
sundar
 
PPT
mysql.ppt
nawaz65
 
PPTX
SQL PPT.pptx
PriyaPandey767008
 
PPTX
Introduction to MySQL in PHP
hamsa nandhini
 
PPTX
about-SQL AND ETC.pptx
jwhuqyqtayaw
 
PDF
sql_data.pdf
VandanaGoyal21
 
PPT
SQL. It education ppt for reference sql process coding
aditipandey498628
 
PPTX
Mysql-overview.pptx
TamilHunt
 
PDF
Introduction to MySQL and introduction to basic queries
anishacotta2
 
PDF
sql.pdf
AnithaIlango
 
PDF
sql10.pdfNGBHJHYGKIIIIYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Pri21Legend
 
PDF
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
zmulani8
 
PDF
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
rohithlingineni1
 
PPTX
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
teachersduniya.com
 
PDF
full detailled SQL notesquestion bank (1).pdf
yvpachorib23
 
CVJ531: Intro to MySQL
Clay Ewing
 
sql.pptx
slavskrillex
 
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
MY SQL
sundar
 
mysql.ppt
nawaz65
 
SQL PPT.pptx
PriyaPandey767008
 
Introduction to MySQL in PHP
hamsa nandhini
 
about-SQL AND ETC.pptx
jwhuqyqtayaw
 
sql_data.pdf
VandanaGoyal21
 
SQL. It education ppt for reference sql process coding
aditipandey498628
 
Mysql-overview.pptx
TamilHunt
 
Introduction to MySQL and introduction to basic queries
anishacotta2
 
sql.pdf
AnithaIlango
 
sql10.pdfNGBHJHYGKIIIIYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Pri21Legend
 
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
zmulani8
 
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
rohithlingineni1
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
teachersduniya.com
 
full detailled SQL notesquestion bank (1).pdf
yvpachorib23
 
Ad

Recently uploaded (20)

PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 

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