SlideShare a Scribd company logo
1 of 4
MYSQL
                           Data Manipulation Language(DML) 
                                                          :
  1.SELECT­ extracts data from a database.
  2.UPDATE­update data from a database.
  3.DELETE ­deletes data from a database.
  4.INSERT INTO – inserts a new data into database

 Select statements:
                                   The Select statement is used to select data from a database.
Syntax
            1.Select *  from table_name
Eg: 
        Select   * from person
            2.Select column_name(s) from table
Eg:   
       Select lastname, firstname from person
Update Statement:
                             The update statement is used to update records in a table.
Syntax:
                   Update table_name set column1=value,column2=value2,...where 
some_column=some_value
Eg:
  Update Persons  set Address='parrys', where LastName='kumar' and FirstName='kalpana'

Delete Statement:
                            The Delete statement is used to delete records in a table.
Syntax:
              Delete from table_name where some_columns =some values
Eg:
       Delete from Persons where LastName='viji' and FirstName='kavitha'

Insert Statement:
                                The Insert into statement is used to insert new records in a table.
Syntax
         Insert into table_name values(value 1,value 2,value 3.........)

Eg:
       Insert into Persons values('15','anu','kanna','minjur')
DDL(Data Definition Languages    

               The DDL part of SQL permits database tables to be created or deleted. It also define 
indexes (keys), specify links between tables, and impose constraints between tables.
             1.creates database­ creates a new database
             2.alter databases­ modifies a databases
             3.create table­ create a new table
             4.alter table­ modifies a table
             5.drop table ­ deletes a table
             6.create index­ creates an index (search key)
             7.drop index ­ deletes an index    

Create database Statement:
                  The create database statement is used to create a database.
Syntax:
      create database database_name
Eg:
     create database my_db

 Create table Statement
         The Create table statement is used to create a table in a database.
Syntax
            Create table_name( column_name1 data_type,column_name2 data_type,column_name3 
data_type,...)
Eg:
     Create table Persons(P_Id int,LastName varchar(255),FirstName varchar(255),Address 
varchar(255))

Alter table Statement: 
          The alter statement is used to add, delete, or modify columns in an existing .
Syntax:
     add a column in a table
            alter table table_name add column_name datatype
Eg:
    alter table Persons add  DateOfBirth date

Drop index Statement
         The drop index statement is used to delete an index in a table.        
Eg :
       Drop index table_name.index_name
Drop table Statement:
        The drop table statement is used to delete a table.
Eg:
      Drop table table_name
Drop database Statement
      The drop database statement is used to delete a database.    
Eg: 
     Drop database database_name
PHP MY ADMIN
                       Php MyAdmin supports a wide range of operations with MySQL. The most
frequently used operations are supported by the user interface (managing
databases, tables, fields, relations, indexes, users, permissions, etc), while you
still have the ability to directly execute any SQL statement.

Features:
              1.Support for most MySQL features.
              2.Import data from CSV and SQL
              3.Administering multiple servers
              4.Creating PDF graphics of your database layout 
              5.Creating complex queries using Query-by-example (QBE)
              6.Searching globally in a database or a subset of it
              7 .Transforming stored data into any format using a set of predefined functions,
like displaying BLOB-data as image or download-link
              8.Export data to various formats: CSV, SQL, XML, PDF, ISO/IEC 26300 -
OpenDocument Text and Spreadsheet, Word, Excel, LATEX and others.

DCL:Data Control Language
1.COMMIT
                             SQL>COMMIT  
      This will commit (write to data base) the transcation done by DML

2.ROLLBACK
                             SQL>ROLLBACK
    This will rollback the transactions and will not commit the changes to the  database. 
 
 3.GRANT
            Giving the permission to acess the user1's objects to user2.
            Grant privilege on <object_name> to <user_ name>
             Grant select,insert,delete,update on empdetails to m

PRIVILEGE:
                                It is the right to access another user's objects.
1.Grant Privilege:
                Giving the permission to acess the user1's objects to user2.
  Grant privilege on <object_name> to <user_ name>
  Grant select,insert,delete,update on empdetails to main_dep

2.Revoke privilege:
                   Withdraw the privilege which has been granted to the user, we use  the revoke command
  Revoke privilege on <object_name> from <user_name>
                              Revoke select,insert,delete,update on emp details 
                              from  main_dep
                    
SQL Functions
        SQL has many built­in functions for performing calculations on data

Aggregate Functions
            SQL aggregate functions return a single value, calculated from values in a column.

    *  AVG() ­ Returns the average value
    * COUNT() ­ Returns the number of rows
    * FIRST() ­ Returns the first value
    * LAST() ­ Returns the last value
    * MAX() ­ Returns the largest value
    * MIN() ­ Returns the smallest value
    * SUM() ­ Returns the sum
Scalar functions
           SQL scalar functions return a single value, based on the input value.
              # UCASE() ­ Converts a field to upper case
              # LCASE() ­ Converts a field to lower case
              # MID() ­ Extract characters from a text field
USERS:
           The mysql database contains a table called user which in turn contains a number of
columns including the user login name and the users various privileges and connection rights. To
obtain a list of users run the following command:
           SELECT user FROM user;
 A newly installed MySQL database will only list one user, the root  
 user:   
           mysql> select user from user;




    

More Related Content

What's hot

Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
Hasan Kata
 

What's hot (20)

Mysql
MysqlMysql
Mysql
 
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
 
Adbms
AdbmsAdbms
Adbms
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 
Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL II
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
Mysql database
Mysql databaseMysql database
Mysql database
 
Introduction to mysql part 1
Introduction to mysql part 1Introduction to mysql part 1
Introduction to mysql part 1
 
Database Basics and MySQL
Database Basics and MySQLDatabase Basics and MySQL
Database Basics and MySQL
 
Data Definition and Data Manipulation Language-DDL & DML
Data Definition and Data Manipulation Language-DDL & DMLData Definition and Data Manipulation Language-DDL & DML
Data Definition and Data Manipulation Language-DDL & DML
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 

Viewers also liked (8)

Presentatie
PresentatiePresentatie
Presentatie
 
Capacity project presentation_20100406
Capacity project presentation_20100406Capacity project presentation_20100406
Capacity project presentation_20100406
 
Capacity project presentation_20100406
Capacity project presentation_20100406Capacity project presentation_20100406
Capacity project presentation_20100406
 
OnState Spring '10 Updates
OnState Spring '10 UpdatesOnState Spring '10 Updates
OnState Spring '10 Updates
 
Capacity project presentation_20100406
Capacity project presentation_20100406Capacity project presentation_20100406
Capacity project presentation_20100406
 
Capacity project presentation
Capacity project presentationCapacity project presentation
Capacity project presentation
 
5 Steps to Being Accepted By Your Dream School
5 Steps to Being Accepted By Your Dream School5 Steps to Being Accepted By Your Dream School
5 Steps to Being Accepted By Your Dream School
 
How to Break Down a Science RC Passage on the GMAT
How to Break Down a Science RC Passage on the GMATHow to Break Down a Science RC Passage on the GMAT
How to Break Down a Science RC Passage on the GMAT
 

Similar to Sql

My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
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
 

Similar to Sql (20)

PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
SQL
SQLSQL
SQL
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Module 3
Module 3Module 3
Module 3
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Introduction to dbms
Introduction to dbmsIntroduction to dbms
Introduction to dbms
 
Mysql
MysqlMysql
Mysql
 
lovely
lovelylovely
lovely
 
ppt.pdf
ppt.pdfppt.pdf
ppt.pdf
 
Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptx
 
PPT SQL CLASS.pptx
PPT SQL CLASS.pptxPPT SQL CLASS.pptx
PPT SQL CLASS.pptx
 
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. .
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

Sql