SlideShare a Scribd company logo
Chrysler
Panaguiton
WEEK 7 – DAY 1
SQL
Overview
SQL is a programming language for Relational Databases. It
is designed over relational algebra and tuple relational
calculus. SQL comes as a package with all major
distributions of RDBMS.
SQL comprises both data definition and data manipulation
languages. Using the data definition properties of SQL, one
can design and modify database schema whereas data
manipulation properties allows SQL to store and retrieve
data from database. SQL is a standard language for storing,
manipulating and retrieving data in databases.
MYSQL Database 2 tier Architecture
MYSQL Database 3 tier Architecture
Client program can be a MySQL
command line client, GUI client, or
a program written in any language
such as C, Perl, PHP, Java that has
an interface to the MySQL server.
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
XAMPP
INSTALLATION
GUIDE
What is XAMPP?
XAMPP is a completely free, easy
to install Apache distribution
containing MariaDB, PHP, and
Perl. The XAMPP open source
package has been set up to be
incredibly easy to install and to
use
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
XAMMP
CONTROL
PANEL
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
LECTURE NOTES.pdf
PHONE INSTALLATION
LECTURE NOTES.pdf
LECTURE NOTES.pdf
Creating a database
DELETING A
DATABASE
COMMON
DATA TYPES
USED IN
MYSQL
Create table example
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
CREATE TABLE WITH PRIMARY KEY
CREATE TABLE Persons (Personid int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL, FirstName varchar(255), Age int,
PRIMARY KEY (Personid));
INSERT INTO STATEMENT
INSERT INTO Persons (FirstName,LastName)
VALUES ('Lars','Monsen');
Summary of CODES
1. mysql –u root –p = To connect to SQL server.
2. show databases; = To show all available and active databases.
3. Use databasename; = To use the database.
4. Show tables; = to check all table of the database used.
5. Create database databasename; = to create a database
6. Drop database databasename; = to delete or remove a database
7. Drop table tablename; = to delete an existing table
8. Use databasename; = to use an existing database
9. Show tables; = to show all tables from a database
10. Describe tablename; = to verify specification of a table
11. * = represents “all”
12. Exit = to go back in connecting to SQL Server
Create table
Table Name: Customer
Field name: CustomerID, Lastname, firstname,City,mobilenumber
UPDATE SYNTAX
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
UPDATE EXAMPLE
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= 'Frankfurt'
WHERE CustomerID = 1;
SELECT STATEMENT
Syntax:
Select * from tablename;
The SQL ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set in ascending or descending order.
The ORDER BY keyword sorts the records in ascending order by default. T
o sort the records in descending order, use the DESC keyword.
SELECT * FROM Customers
ORDER BY Country DESC;
SELECT * FROM Customers
ORDER BY Country ASC;
Select specific field of table
SYNTAX:
Select fieldname,fieldname from tablename;
SQL ALTER TABLE Statement
The ALTER TABLE statement is used to add, delete, or modify columns in an
existing table.
The ALTER TABLE statement is also used to add and drop various
constraints on an existing table.
To add a column in a table, use the following
syntax:
ALTER TABLE table_name
ADD column_name datatype;
Example
ALTER TABLE Customers
ADD Email varchar(255);
BETWEEN OPERATOR
DELETE DATA INSIDE A TABLE
WHERE LIKE OPERATORS
LOGICAL COMPARATOR
LECTURE NOTES.pdf
PERFORMANCE
TASK
DEADLINE MARCH 20, 2021
SATURDAY 5PM
ID – Primary key Student_ID Math Science English
1 2020-0001 85 87 90
2 2020-0002 74 73 75
3 2021-1020 87 90 88
4 2021-1023 70 72 75
5 2021-1030 85 87 90
ID – Primary key Student_ID Math Science English Gen_Ave
1 2020-0001 85 87 90 87.33
2 2020-0002 74 73 75 74
3 2021-1020 87 90 88 88.33
4 2021-1023 70 72 75 72.33
5 2021-1030 85 87 90 87.34
Arboleda = 1000
Tejas = 550
Almaden = 1050
Almaden Mobile num = 0916-225-0012
QUERY + 3
Lastname, firstname,mobilenum, expenses order by ASC LASTNAME
Lastname, firstname,mobilenum, expenses order by DESC FIRSTNAME
-----

More Related Content

Similar to LECTURE NOTES.pdf (20)

PDF
BCS4L1-Database Management lab.pdf
KeerthanaP37
 
PDF
Sql12
tacex1
 
PPTX
Introduction to SQL
MLG College of Learning, Inc
 
PDF
sql10.pdfNGBHJHYGKIIIIYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Pri21Legend
 
PPTX
lovely
love0323
 
PPTX
SQL Queries Information
Nishant Munjal
 
PPT
MySQL and its basic commands
Bwsrang Basumatary
 
PDF
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
PPT
MySql slides (ppt)
webhostingguy
 
PDF
PT- Oracle session01
Karthik Venkatachalam
 
PPTX
Database COMPLETE
Abrar ali
 
PDF
Sql
Atul Pant
 
PDF
Sql tutorial
Rumman Ansari
 
PPTX
SQl data base management and design
franckelsania20
 
PPT
MySQL intro
David Rajah Selvaraj
 
PPT
MySQL intro
David Rajah Selvaraj
 
DOCX
Database Management Lab -SQL Queries
shamim hossain
 
PPTX
Data Base Management 1 Database Management.pptx
PreeTVithule1
 
DOC
Module 3
cs19club
 
BCS4L1-Database Management lab.pdf
KeerthanaP37
 
Sql12
tacex1
 
Introduction to SQL
MLG College of Learning, Inc
 
sql10.pdfNGBHJHYGKIIIIYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Pri21Legend
 
lovely
love0323
 
SQL Queries Information
Nishant Munjal
 
MySQL and its basic commands
Bwsrang Basumatary
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
MySql slides (ppt)
webhostingguy
 
PT- Oracle session01
Karthik Venkatachalam
 
Database COMPLETE
Abrar ali
 
Sql tutorial
Rumman Ansari
 
SQl data base management and design
franckelsania20
 
Database Management Lab -SQL Queries
shamim hossain
 
Data Base Management 1 Database Management.pptx
PreeTVithule1
 
Module 3
cs19club
 

More from ChryslerPanaguiton (8)

PPTX
Human Capital Transition to Human Centri
ChryslerPanaguiton
 
PDF
Report Selection Process PPTA systematic
ChryslerPanaguiton
 
PPTX
HRM (Human Resource Management) plays a k
ChryslerPanaguiton
 
PPTX
Human Capital Discuss how HR move to human centric that focuses on arts idea ...
ChryslerPanaguiton
 
PPTX
April 1 - Lesson COMPUTER ETHICS and SAFETY.pptx
ChryslerPanaguiton
 
PPTX
Algorithms and Complexity.pptx
ChryslerPanaguiton
 
PDF
Intro Part 1 - Science, Technology & Society.pdf
ChryslerPanaguiton
 
PDF
LECTURE NOTES.pdf
ChryslerPanaguiton
 
Human Capital Transition to Human Centri
ChryslerPanaguiton
 
Report Selection Process PPTA systematic
ChryslerPanaguiton
 
HRM (Human Resource Management) plays a k
ChryslerPanaguiton
 
Human Capital Discuss how HR move to human centric that focuses on arts idea ...
ChryslerPanaguiton
 
April 1 - Lesson COMPUTER ETHICS and SAFETY.pptx
ChryslerPanaguiton
 
Algorithms and Complexity.pptx
ChryslerPanaguiton
 
Intro Part 1 - Science, Technology & Society.pdf
ChryslerPanaguiton
 
LECTURE NOTES.pdf
ChryslerPanaguiton
 
Ad

Recently uploaded (20)

PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
Hashing Introduction , hash functions and techniques
sailajam21
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
Design Thinking basics for Engineers.pdf
CMR University
 
Day2 B2 Best.pptx
helenjenefa1
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Ad

LECTURE NOTES.pdf

  • 2. SQL Overview SQL is a programming language for Relational Databases. It is designed over relational algebra and tuple relational calculus. SQL comes as a package with all major distributions of RDBMS. SQL comprises both data definition and data manipulation languages. Using the data definition properties of SQL, one can design and modify database schema whereas data manipulation properties allows SQL to store and retrieve data from database. SQL is a standard language for storing, manipulating and retrieving data in databases.
  • 3. MYSQL Database 2 tier Architecture
  • 4. MYSQL Database 3 tier Architecture
  • 5. Client program can be a MySQL command line client, GUI client, or a program written in any language such as C, Perl, PHP, Java that has an interface to the MySQL server.
  • 10. What is XAMPP? XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use
  • 30. Create table example CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) );
  • 31. CREATE TABLE WITH PRIMARY KEY CREATE TABLE Persons (Personid int NOT NULL AUTO_INCREMENT, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, PRIMARY KEY (Personid));
  • 32. INSERT INTO STATEMENT INSERT INTO Persons (FirstName,LastName) VALUES ('Lars','Monsen');
  • 33. Summary of CODES 1. mysql –u root –p = To connect to SQL server. 2. show databases; = To show all available and active databases. 3. Use databasename; = To use the database. 4. Show tables; = to check all table of the database used. 5. Create database databasename; = to create a database 6. Drop database databasename; = to delete or remove a database 7. Drop table tablename; = to delete an existing table 8. Use databasename; = to use an existing database 9. Show tables; = to show all tables from a database 10. Describe tablename; = to verify specification of a table 11. * = represents “all” 12. Exit = to go back in connecting to SQL Server
  • 34. Create table Table Name: Customer Field name: CustomerID, Lastname, firstname,City,mobilenumber
  • 35. UPDATE SYNTAX UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
  • 36. UPDATE EXAMPLE UPDATE Customers SET ContactName = 'Alfred Schmidt', City= 'Frankfurt' WHERE CustomerID = 1;
  • 38. The SQL ORDER BY Keyword The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. T o sort the records in descending order, use the DESC keyword. SELECT * FROM Customers ORDER BY Country DESC; SELECT * FROM Customers ORDER BY Country ASC;
  • 39. Select specific field of table SYNTAX: Select fieldname,fieldname from tablename;
  • 40. SQL ALTER TABLE Statement The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table. To add a column in a table, use the following syntax: ALTER TABLE table_name ADD column_name datatype; Example ALTER TABLE Customers ADD Email varchar(255);
  • 47. ID – Primary key Student_ID Math Science English 1 2020-0001 85 87 90 2 2020-0002 74 73 75 3 2021-1020 87 90 88 4 2021-1023 70 72 75 5 2021-1030 85 87 90
  • 48. ID – Primary key Student_ID Math Science English Gen_Ave 1 2020-0001 85 87 90 87.33 2 2020-0002 74 73 75 74 3 2021-1020 87 90 88 88.33 4 2021-1023 70 72 75 72.33 5 2021-1030 85 87 90 87.34
  • 49. Arboleda = 1000 Tejas = 550 Almaden = 1050 Almaden Mobile num = 0916-225-0012 QUERY + 3 Lastname, firstname,mobilenum, expenses order by ASC LASTNAME Lastname, firstname,mobilenum, expenses order by DESC FIRSTNAME -----