SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Introduction To DBMS and
MySQL
DDL,DML,DCL
Week 5 – Day1
What is Database?
• A collection of information organized in
such a way that a computer program can
quickly select desired pieces of data.
• You can think of a database as an
electronic filing system
Front End: done in PHP / .Net / JSP or
any server side scripting languages
Stores data at the Back end database
in MYSQL/SQL Server / Oracle or any
other DBMS
Where do we use Database?
Database management system
(DBMS)“Simply DBMS helps you to create and manage
databases- same like MSWord helps you to create
or manage word documents.”
– DBMS is a computer software providing the
interface between users and a database (or
databases)
– It is a software system designed to allow the
definition, creation, querying, update, and
administration of databases
– Different types of DBMS are RDBMS, Object
Oriented DBMS, Network DBMS, Hierarchical
DBMS
Database management system
(DBMS)
“ The RDBMS follows
Entity- Relationship modal”
What is Entity – Relationship
(ER) Data Model ?
In ER modal all the data will be viewed as
Entities, Attributes and different relations that
can be defined between entities
• Entities
– Is an object in the real world that is
distinguishable from other objects
– Ex. Employees, Places
• Attributes
– An entity is described in the database using a set
of attributes
– Ex. Employee_Name, Employee_Age, Gender
Entity – Relationship (ER) Data
Model ?
• So a relation means simply a two
dimensional table
• Entities will be data with in a table
• And attributes will be the columns of that
table
Relational model basics
• Data is viewed as existing in two dimensional
tables known as relations.
• A relation (table) consists of unique attributes
(columns) and tuples (rows)
• RDBMS: A DBMS that manages the relational
Emp_id Emp_name Emp_age Emp_email
1000 Deepak 24 dk@gmail.com
1001 Aneesh 23 an@gmail.com
1002 Naveen 25 nn@gmail.com
1003 Jacob 25 jb@gmail.com
Attributes/Fields/Columns
Rows/
Records/
Tuples
Relational model Example
Pk_int_id Vchr_Designation
1 Area manager
2 Supervisor
3 Software Engineer
4 Clerk
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id
1000 Deepak 24 dk@gmail.com 1 1
1001 Aneesh 23 an@gmail.com 2 1
1002 Naveen 25 nn@gmail.com 1 2
1003 Jacob 25 jb@gmail.com 3 4
Tbl_designation Tbl_place
Tbl_employee
Keys in relational Model
• Primary Key
• Here there are 2 employees with name “Deepak”
but each can be identified distinctly by defining a
primary key
Emp_name Emp_age Emp_email Fk_int_designation Pk_int_place_id
Deepak 45 dk@gmail.com 1 1
Aneesh 23 an@gmail.com 2 1
Naveen 25 nn@gmail.com 1 2
Deepak 25 dpk@gmail.com 4 4
Keys in relational Model
• Primary Key
– The PRIMARY KEY constraint uniquely
identifies each record in a database table.
Emp_id Emp_name Emp_age Emp_email Fk_int_designation Pk_int_place_id
1000 Deepak 45 dk@gmail.com 1 1
1001 Aneesh 23 an@gmail.com 2 1
1002 Naveen 25 nn@gmail.com 1 2
1003 Deepak 25 dpk@gmail.com 4 4
Relational model Example
Pk_int_id Vchr_Designation
1 Area manager
2 Supervisor
3 Software Engineer
4 Clerk
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id
1000 Deepak 24 dk@gmail.com 1 1
1001 Aneesh 23 an@gmail.com 2 1
1002 Naveen 25 nn@gmail.com 1 2
1003 Jacob 25 jb@gmail.com 3 4
Tbl_designation Tbl_place
Tbl_employee
• Foreign Key
A Foreign key in one table points to a Primary
Key of another table.
MySQL
• It is the world's most used open source
relational database management system
(RDBMS).It is named after cofounder
Michael Widenius' daughter, My. The SQL
phrase stands for Structured Query
Language
• In January 2008, Sun Microsystems
bought MySQL for $1 billion
3 Types Of Sql Statements
• Data Definition Language (DDL)
• are used to define the database structure or schema.
– Create
– Alter
– Drop
– Truncate
• Data Manipulation Language (DML)
• are used for managing data within schema objects.
– Insert
– Update
– Delete
– SELECT
• Data Control Language (DCL) statements.
• Used to create roles, permissions, and referential integrity as well it is used to control
access to database by securing it.
– Grant
– Revoke
– Commit
– Rollback
DDL Statements
Create - Database
• To create a Database
– Syntax : CREATE DATABASE dbname;
– Example : CREATE DATABASE my_db;
• To Use a database
– Syntax : Use dbname;
– Example : Use my_db;
Creating a table
• Syntax
CREATE
TABLE table_name
(
column_name1
data_type(size),
column_name2
data_type(size),
column_name3
data_type(size),
PRIMARY
KEY(column_name1)
);
• Example
CREATE TABLE Person
(
PersonID int
auto_increment,
FirstName varchar(25
Address varchar(255)
City varchar(255),
Primary key(Personal
);
DDL - Altering a table
• ALTER TABLE Persons ADD email
VARCHAR(60);
• ALTER TABLE Persons DROP COLUMN city;
• ALTER TABLE Persons CHANGE FirstName
FullName VARCHAR(20);
DDL - Deleting a Table
• DROP TABLE table_name ;
DML Statements
DML - Insert Data into a table
• Syntax :
– INSERT INTO table_name VALUES
(value1,value2,value3,...);
• Example:
– INSERT INTO Customers (CustomerName,
City, Country)
VALUES (baabtra', „Calicut', „India');
• Note : String and date values are specified as
quoted string. Also with insert you can insert
DML -Retrieving information
from a table
“The SELECT statement is used to pull data from a
table”
• Syntax:
– SELECT what_to_select FROM table_name
Where conditions_to_satisfy ;
What_to_select
indicates what you
want to see. This
can be a list of
columns or * to
The Where clause is
optional. If it is present,
conditions_to_satisfy
specifies one or more
conditions that rows
must satisfy to qualify for
DML - Example
• Select * from person;
• Select id,firstname from person;
• Select * from person where city=„banglore‟
DML - Update Query
• Syntax:
• UPDATE table_name
SET column1=value1,column2=value
2,...
WHERE some_column=some_value;
• Example:
• UPDATE Customers
SET ContactName=„Alex',
City=„calicut'
WHERE CustomerName=„baabtra';
Delete Query
• Syntax:
– DELETE FROM table_name
WHERE some_column=some_value;
• Example :
– DELETE FROM Customers
WHERE CustomerName=„baabtra' AND
ContactName='Maria';
DCL Statements
DCL – Setting Privilege
• Example:
• GRANT ALL ON baabtra.user TO
'someuser'@'somehost';
• REVOKE ALL ON baabtra.user FROM
What previlages to be
given
All -> will set all the
privileges
SELECT-> will set only to
select privilage
table
name
Usern
ame
Questions?
“A good question deserve a good
grade…”
Self Check !!
Self Check !!
• Attribute of an entity is represented as
– Row
– Column
– table
Self Check !!
• Attribute of an entity is represented as
– Row
– Column
– table
Self Check !!
• In ER model each entity is represented
within
– Relations/tables
– Attributes
– Schemas
– Objects
Self Check !!
• In ER model each entity is represented
within
– Relations/tables
– Attributes
– Schemas
– Objects
Self Check !!
• DDL is used to
– Define/Manipulate the data
– Define/Manipulate the structure of data
– Define/Manipulate the access privilege
Self Check !!
• DDL is used to
– Define/Manipulate the data
– Define/Manipulate the structure of data
– Define/Manipulate the access privilege
Self Check !!
• Example for DML is
– Deleting all table data
– Creating a column
– Changing column data type
Self Check !!
• Example for DML is
– Deleting all table data
– Creating a column
– Changing column data type
Self Check !!
• Write a query to create below table
• create table tbl_place
(
pk_int_id int primary key auto_increment,
vchr_place varchar(20)
);
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
Self Check !!
• Write a query to create below table
• create table tbl_place
(
pk_int_id int primary key auto_increment,
vchr_place varchar(20)
);
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
Self Check !!
• Write a query to add one more column
named “int_pin”
Ans: Alter table add column int_pin int;
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
Self Check !!
• Write a query to add one more column
named “int_pin”
Ans: Alter table add column int_pin int;
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
End of Day

Weitere ähnliche Inhalte

Was ist angesagt?

Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introductionHasan Kata
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQLEhsan Hamzei
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introductionSmriti Jain
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaEdureka!
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st sessionMedhat Dawoud
 
Introduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLIntroduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLHarmony Kwawu
 
Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL Abdul Rehman
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningeVideoTuition
 
Types of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiTypes of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiNaveen Kumar Veligeti
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETEAbrar ali
 

Was ist angesagt? (19)

Sql commands
Sql commandsSql commands
Sql commands
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 
SQL commands
SQL commandsSQL commands
SQL commands
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st session
 
Introduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLIntroduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQL
 
DBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCLDBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCL
 
Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
 
Types of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiTypes of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligeti
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 

Andere mochten auch (9)

Sql
SqlSql
Sql
 
DBMS Bascis
DBMS BascisDBMS Bascis
DBMS Bascis
 
DBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) pptDBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) ppt
 
Fixed Assets And Liabilities
Fixed Assets And LiabilitiesFixed Assets And Liabilities
Fixed Assets And Liabilities
 
Dml and ddl
Dml and ddlDml and ddl
Dml and ddl
 
DML Commands
DML CommandsDML Commands
DML Commands
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 

Ähnlich wie Introduction to mysql part 1

Database management system.pptx
Database management system.pptxDatabase management system.pptx
Database management system.pptxAshmitKashyap1
 
Adv DB - Full Handout.pdf
Adv DB - Full Handout.pdfAdv DB - Full Handout.pdf
Adv DB - Full Handout.pdf3BRBoruMedia
 
Ch 2-introduction to dbms
Ch 2-introduction to dbmsCh 2-introduction to dbms
Ch 2-introduction to dbmsRupali Rana
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptxnatesanp1234
 
Week 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxWeek 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxRiannel Tecson
 
Complete first chapter rdbm 17332
Complete first chapter rdbm 17332Complete first chapter rdbm 17332
Complete first chapter rdbm 17332Tushar Wagh
 
Database system concepts
Database system conceptsDatabase system concepts
Database system conceptsKumar
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .MayankSinghRawat6
 
Relational Database.pptx
Relational Database.pptxRelational Database.pptx
Relational Database.pptxSubhamSarkar64
 
How Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsHow Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsChad Petrovay
 
Ch1.2_DB system Concepts and Architecture.pptx
Ch1.2_DB system Concepts and Architecture.pptxCh1.2_DB system Concepts and Architecture.pptx
Ch1.2_DB system Concepts and Architecture.pptx01fe20bcv092
 

Ähnlich wie Introduction to mysql part 1 (20)

SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
Database management system.pptx
Database management system.pptxDatabase management system.pptx
Database management system.pptx
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Adv DB - Full Handout.pdf
Adv DB - Full Handout.pdfAdv DB - Full Handout.pdf
Adv DB - Full Handout.pdf
 
Ch 2-introduction to dbms
Ch 2-introduction to dbmsCh 2-introduction to dbms
Ch 2-introduction to dbms
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
 
Dbms Basics
Dbms BasicsDbms Basics
Dbms Basics
 
Week 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxWeek 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptx
 
Complete first chapter rdbm 17332
Complete first chapter rdbm 17332Complete first chapter rdbm 17332
Complete first chapter rdbm 17332
 
Database system concepts
Database system conceptsDatabase system concepts
Database system concepts
 
Pl sql content
Pl sql contentPl sql content
Pl sql content
 
database1.pdf
database1.pdfdatabase1.pdf
database1.pdf
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
Relational Database.pptx
Relational Database.pptxRelational Database.pptx
Relational Database.pptx
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
How Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsHow Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill Sets
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
DBMS
DBMS DBMS
DBMS
 
intro for sql
intro for sql intro for sql
intro for sql
 
Ch1.2_DB system Concepts and Architecture.pptx
Ch1.2_DB system Concepts and Architecture.pptxCh1.2_DB system Concepts and Architecture.pptx
Ch1.2_DB system Concepts and Architecture.pptx
 

Mehr von baabtra.com - No. 1 supplier of quality freshers

Mehr von baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Baabtra soft skills
 
Cell phone jammer
Cell phone jammerCell phone jammer
Cell phone jammer
 

Kürzlich hochgeladen

Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 

Kürzlich hochgeladen (20)

Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 

Introduction to mysql part 1

  • 1. Introduction To DBMS and MySQL DDL,DML,DCL Week 5 – Day1
  • 2. What is Database? • A collection of information organized in such a way that a computer program can quickly select desired pieces of data. • You can think of a database as an electronic filing system
  • 3. Front End: done in PHP / .Net / JSP or any server side scripting languages Stores data at the Back end database in MYSQL/SQL Server / Oracle or any other DBMS Where do we use Database?
  • 4. Database management system (DBMS)“Simply DBMS helps you to create and manage databases- same like MSWord helps you to create or manage word documents.”
  • 5. – DBMS is a computer software providing the interface between users and a database (or databases) – It is a software system designed to allow the definition, creation, querying, update, and administration of databases – Different types of DBMS are RDBMS, Object Oriented DBMS, Network DBMS, Hierarchical DBMS Database management system (DBMS)
  • 6. “ The RDBMS follows Entity- Relationship modal”
  • 7. What is Entity – Relationship (ER) Data Model ? In ER modal all the data will be viewed as Entities, Attributes and different relations that can be defined between entities • Entities – Is an object in the real world that is distinguishable from other objects – Ex. Employees, Places • Attributes – An entity is described in the database using a set of attributes – Ex. Employee_Name, Employee_Age, Gender
  • 8. Entity – Relationship (ER) Data Model ? • So a relation means simply a two dimensional table • Entities will be data with in a table • And attributes will be the columns of that table
  • 9. Relational model basics • Data is viewed as existing in two dimensional tables known as relations. • A relation (table) consists of unique attributes (columns) and tuples (rows) • RDBMS: A DBMS that manages the relational Emp_id Emp_name Emp_age Emp_email 1000 Deepak 24 dk@gmail.com 1001 Aneesh 23 an@gmail.com 1002 Naveen 25 nn@gmail.com 1003 Jacob 25 jb@gmail.com Attributes/Fields/Columns Rows/ Records/ Tuples
  • 10. Relational model Example Pk_int_id Vchr_Designation 1 Area manager 2 Supervisor 3 Software Engineer 4 Clerk Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id 1000 Deepak 24 dk@gmail.com 1 1 1001 Aneesh 23 an@gmail.com 2 1 1002 Naveen 25 nn@gmail.com 1 2 1003 Jacob 25 jb@gmail.com 3 4 Tbl_designation Tbl_place Tbl_employee
  • 11. Keys in relational Model • Primary Key • Here there are 2 employees with name “Deepak” but each can be identified distinctly by defining a primary key Emp_name Emp_age Emp_email Fk_int_designation Pk_int_place_id Deepak 45 dk@gmail.com 1 1 Aneesh 23 an@gmail.com 2 1 Naveen 25 nn@gmail.com 1 2 Deepak 25 dpk@gmail.com 4 4
  • 12. Keys in relational Model • Primary Key – The PRIMARY KEY constraint uniquely identifies each record in a database table. Emp_id Emp_name Emp_age Emp_email Fk_int_designation Pk_int_place_id 1000 Deepak 45 dk@gmail.com 1 1 1001 Aneesh 23 an@gmail.com 2 1 1002 Naveen 25 nn@gmail.com 1 2 1003 Deepak 25 dpk@gmail.com 4 4
  • 13. Relational model Example Pk_int_id Vchr_Designation 1 Area manager 2 Supervisor 3 Software Engineer 4 Clerk Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id 1000 Deepak 24 dk@gmail.com 1 1 1001 Aneesh 23 an@gmail.com 2 1 1002 Naveen 25 nn@gmail.com 1 2 1003 Jacob 25 jb@gmail.com 3 4 Tbl_designation Tbl_place Tbl_employee • Foreign Key A Foreign key in one table points to a Primary Key of another table.
  • 14. MySQL • It is the world's most used open source relational database management system (RDBMS).It is named after cofounder Michael Widenius' daughter, My. The SQL phrase stands for Structured Query Language • In January 2008, Sun Microsystems bought MySQL for $1 billion
  • 15. 3 Types Of Sql Statements • Data Definition Language (DDL) • are used to define the database structure or schema. – Create – Alter – Drop – Truncate • Data Manipulation Language (DML) • are used for managing data within schema objects. – Insert – Update – Delete – SELECT • Data Control Language (DCL) statements. • Used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it. – Grant – Revoke – Commit – Rollback
  • 17. Create - Database • To create a Database – Syntax : CREATE DATABASE dbname; – Example : CREATE DATABASE my_db; • To Use a database – Syntax : Use dbname; – Example : Use my_db;
  • 18. Creating a table • Syntax CREATE TABLE table_name ( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), PRIMARY KEY(column_name1) ); • Example CREATE TABLE Person ( PersonID int auto_increment, FirstName varchar(25 Address varchar(255) City varchar(255), Primary key(Personal );
  • 19. DDL - Altering a table • ALTER TABLE Persons ADD email VARCHAR(60); • ALTER TABLE Persons DROP COLUMN city; • ALTER TABLE Persons CHANGE FirstName FullName VARCHAR(20); DDL - Deleting a Table • DROP TABLE table_name ;
  • 21. DML - Insert Data into a table • Syntax : – INSERT INTO table_name VALUES (value1,value2,value3,...); • Example: – INSERT INTO Customers (CustomerName, City, Country) VALUES (baabtra', „Calicut', „India'); • Note : String and date values are specified as quoted string. Also with insert you can insert
  • 22. DML -Retrieving information from a table “The SELECT statement is used to pull data from a table” • Syntax: – SELECT what_to_select FROM table_name Where conditions_to_satisfy ; What_to_select indicates what you want to see. This can be a list of columns or * to The Where clause is optional. If it is present, conditions_to_satisfy specifies one or more conditions that rows must satisfy to qualify for
  • 23. DML - Example • Select * from person; • Select id,firstname from person; • Select * from person where city=„banglore‟
  • 24. DML - Update Query • Syntax: • UPDATE table_name SET column1=value1,column2=value 2,... WHERE some_column=some_value; • Example: • UPDATE Customers SET ContactName=„Alex', City=„calicut' WHERE CustomerName=„baabtra';
  • 25. Delete Query • Syntax: – DELETE FROM table_name WHERE some_column=some_value; • Example : – DELETE FROM Customers WHERE CustomerName=„baabtra' AND ContactName='Maria';
  • 27. DCL – Setting Privilege • Example: • GRANT ALL ON baabtra.user TO 'someuser'@'somehost'; • REVOKE ALL ON baabtra.user FROM What previlages to be given All -> will set all the privileges SELECT-> will set only to select privilage table name Usern ame
  • 28. Questions? “A good question deserve a good grade…”
  • 30. Self Check !! • Attribute of an entity is represented as – Row – Column – table
  • 31. Self Check !! • Attribute of an entity is represented as – Row – Column – table
  • 32. Self Check !! • In ER model each entity is represented within – Relations/tables – Attributes – Schemas – Objects
  • 33. Self Check !! • In ER model each entity is represented within – Relations/tables – Attributes – Schemas – Objects
  • 34. Self Check !! • DDL is used to – Define/Manipulate the data – Define/Manipulate the structure of data – Define/Manipulate the access privilege
  • 35. Self Check !! • DDL is used to – Define/Manipulate the data – Define/Manipulate the structure of data – Define/Manipulate the access privilege
  • 36. Self Check !! • Example for DML is – Deleting all table data – Creating a column – Changing column data type
  • 37. Self Check !! • Example for DML is – Deleting all table data – Creating a column – Changing column data type
  • 38. Self Check !! • Write a query to create below table • create table tbl_place ( pk_int_id int primary key auto_increment, vchr_place varchar(20) ); Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place
  • 39. Self Check !! • Write a query to create below table • create table tbl_place ( pk_int_id int primary key auto_increment, vchr_place varchar(20) ); Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place
  • 40. Self Check !! • Write a query to add one more column named “int_pin” Ans: Alter table add column int_pin int; Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place
  • 41. Self Check !! • Write a query to add one more column named “int_pin” Ans: Alter table add column int_pin int; Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place