SlideShare a Scribd company logo
Let’s work with Database (MySql)
Author:- Subhasis
CMC
MySql & RDBMS
• MySQL is a Relational Database Management
  System (RDBMS).
• server can manage many databases at the same
  time.
• In fact many people might have different databases
  managed by a single MySQL server.
• Each database consists of a structure to hold the
  data and the data itself.
• A database can exist without data.
Cont’d …..
• Data in a database is stored in one or more
  tables.
Cont’d ….
• First you create the empty database.
• Then you add empty tables to the database.
• Table is organized with in rows and columns.
• Each row represents an entity in the database
• Each column contains an item of information about
  the entity.
• The place where a particular row and column
  intersect, the individual cell of the table, is called a
  field.
Cont’d …..
• Tables in databases can be related.
• Often a row in one table is related to several
  rows in another table.
• You include a column in one table to hold data
  that matches data in the column of another
  table.
Related tables
Communicating with DataBase
• All our interaction with the database is
  accomplished by passing messages to the MySQL
  server.
• It must be able to understand the instructions that
  you send it.
• So we communicate using Structured Query
  Language (SQL), which is a standard computer
  language     understood    by    most      database
  management systems
Cont’d …..

• To make a request that MySQL can understand,
  you build an SQL query and send it to the
  MySQL server.
Building SQL queries
• The first word of each query is its name name, which is an
  action word (a verb) that tells MySQL what we want to do.
• Queries we discuss here:
  ▫   CREATE
  ▫   DROP
  ▫   ALTER
  ▫   SHOW
  ▫   INSERT
  ▫   LOAD
  ▫   SELECT
  ▫   UPDATE
  ▫   DELETE
Cont’d ….

• The query name is followed by words and
  phrases — some required and some optional —
  that tell MySQL how to perform the action.
• For insntace we have to tell the table name to
  which we want to insert the data.
Don’t forget

• SQL language words in all caps.
• SQL words must be separated by one or more
  spaces.
• Put the string within double quote.
Sending SQL query
• We can send sql query to do what we desire to do
  using:
 ▫ The mysql client - A text-based mysql client is
   automatically installed when we install MYSQL.
 ▫ Administration software - Separate software
   packages that are available can provide a more user-
   friendly interface for interacting with MySQL than the
   mysql client does.
 ▫ PHP built in function –we communicate with a
   MySQL database from PHP scripts by using PHP built-
   in functions designed specifically for this purpose.
Using the mysql client
• To send SQL queries to MySQL from the mysql client,
  follow these steps:
 A. Locate the mysql client(it is in bin of your mysql
    directory) we can start it fom Command prompt of
    Windows
 B. To start command is (mysql -u root -p)
 C. If you are in network then you need command (mysql -h
    mysqlhost.mycompany.com -u root -p)
 D. At the mysql prompt, type your SQL query followed by a
    semicolon (;) and then press Enter.
 E. To leave the mysql client, type quit at the prompt and
    then press Enter.
Using Administration software
• To work with mySql using admin software We need
  these steps as follow:
 A. Open your browser and access the phpMyAdmin
    main page.(localhost:Portnumber/phpmyadmin)
 B. Click the down arrow in the databases field in the
    left pane of the phpMyAdmin page. Click the name
    of the database you want to open.
 C. Click the SQL link near the top center of the page.
 D. Type your SQL query in the text area
 E. Click Go below the query text area.
Protect Ur DB before hacked
• MySQL accounts: No one can access the data in
  your database without an account. Sp protect ur
  database with a strong password.
• Permissions: MySQL uses account permissions
  to specify who can do what. Differentiate the
  tasks using different user name and password
  for different tasks.
Designing Database
Field
• The individual cell in which a particular row and
  column intersect is called a field.
Better to be organized
• The table name should clearly identify the
  objects that it contains with a descriptive word
  or term.
• Column name must speaks about hat will be
  filled in it.
• Name of column and table is case sensitive.
• Identify the primary key
Cont’d ….
Creating table
• To cretae table we need CREATE TABLE
  command as follows.


 CREATE TABLE table_name ( column_name NOT NULL PRIMARY
 KEY,
 column_name VARCHAR(37) NOT NULL,
 column_name VARCHAR(2) NULL );
SELECT command
• To fetch / read data we need SELECT command.
• We will search the record and show them using
  SELECT command.
              SELECT * from employee;
• To search something specific we need WHERE
  clause. SELECT * from employee WHERE
                designation=‘manager’;
Where to put single quote
ORDER BY
• ORDER BY clause is to ensure that the result set produced by
  the query is returned in the specified sequence. Simply,
  ORDER BY sorts the results.
• Following the ORDER BY keywords is at least one column
  with an optional ASC (ascending) or DESC (descending)
  keyword; if neither is specified, ascending is the default.


                ORDER BY column [ASC | DESC]
                  [, column [ASC | DESC]] ⋮
INSERT command
• The INSERT statement inserts one or more
  rows.


INSERT INTO table name (colm1, colm2, colm3..)
VALUES (valu1,value2,value3,vlaue4);
UPDATE command
 • The UPDATE DML statement is similar to the ALTER DDL
   statement in that it produces a change.
 • The difference is that, whereas ALTER changes the
   structure of a table, UPDATE changes the data contained
   within a table, while the table’s structure remains the same.


UPDATE table_name SET column_name = ‘value’;

UPDATE table_name SET column_name = ‘value’
WHERE column_name=‘value’;
DELETE command
 • The DELETE DML statement is similar to the DROP DDL
   statement, in that it removes objects from the database. The
   difference is that DROP removes a table from the
   database, while DELETE removes entire rows of data
   from a table, but the table continues to exist.

DELETE FROM table_name WHERE
column_name = ‘value’;

More Related Content

What's hot

Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
Taha Malampatti
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Pongsakorn U-chupala
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
Md.Mojibul Hoque
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introductionHasan Kata
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
Nicole Ryan
 
Android database tutorial
Android database tutorialAndroid database tutorial
Android database tutorial
info_zybotech
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With MysqlHarit Kothari
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Database presentation
Database presentationDatabase presentation
Database presentationwebhostingguy
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
jeetendra mandal
 
BITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema designBITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema design
BITS
 
Sql
SqlSql
MySQL
MySQLMySQL
php basic sql
php basic sqlphp basic sql
php basic sql
tumetr1
 

What's hot (19)

Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
Android database tutorial
Android database tutorialAndroid database tutorial
Android database tutorial
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
lab56_db
lab56_dblab56_db
lab56_db
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With Mysql
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Database presentation
Database presentationDatabase presentation
Database presentation
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
 
BITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema designBITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema design
 
Sql
SqlSql
Sql
 
MySQL
MySQLMySQL
MySQL
 
php basic sql
php basic sqlphp basic sql
php basic sql
 
Mysql
MysqlMysql
Mysql
 
MySQL lecture
MySQL lectureMySQL lecture
MySQL lecture
 

Viewers also liked

My sql presentation
My sql presentationMy sql presentation
My sql presentationNikhil Jain
 
Sql presentation 1 by chandan
Sql presentation 1 by chandanSql presentation 1 by chandan
Sql presentation 1 by chandan
Linux international training Center
 
Mysql database
Mysql databaseMysql database
Mysql database
Arshikhan08
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academy
thewebsacademy
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
Computer Hardware & Trouble shooting
 
MySQL Database with phpMyAdmin
MySQL Database with  phpMyAdminMySQL Database with  phpMyAdmin
MySQL Database with phpMyAdmin
Karwan Mustafa Kareem
 
Industrial training report
Industrial training reportIndustrial training report
Industrial training report
Anurag Gautam
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Giuseppe Maxia
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
Tushar Chauhan
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007
crespoje
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
Guru Ji
 

Viewers also liked (14)

My sql presentation
My sql presentationMy sql presentation
My sql presentation
 
Sql presentation 1 by chandan
Sql presentation 1 by chandanSql presentation 1 by chandan
Sql presentation 1 by chandan
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Mysql database
Mysql databaseMysql database
Mysql database
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academy
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
MySQL Database with phpMyAdmin
MySQL Database with  phpMyAdminMySQL Database with  phpMyAdmin
MySQL Database with phpMyAdmin
 
Industrial training report
Industrial training reportIndustrial training report
Industrial training report
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
 

Similar to working with database using mysql

SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
enosislearningcom
 
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
PavithSingh
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
NilamHonmane
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
Sankhya_Analytics
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
StephenEfange3
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
TamilHunt
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
Saeid Zebardast
 
MYSql manage db
MYSql manage dbMYSql manage db
MYSql manage db
Ahmed Farag
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
HudaRaghibKadhim
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
Abrar ali
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
Ahsan Kabir
 
MS SQL Server
MS SQL ServerMS SQL Server
MS SQL Server
Md. Mahedee Hasan
 
QSpiders - Interacting with My SQL Database
QSpiders - Interacting with My SQL DatabaseQSpiders - Interacting with My SQL Database
QSpiders - Interacting with My SQL Database
Qspiders - Software Testing Training Institute
 
ms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptxms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptx
YashaswiniSrinivasan1
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
MohamedNowfeek1
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
TamiratDejene1
 
Mangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.pptMangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.ppt
Mihir Shah
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 

Similar to working with database using mysql (20)

SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
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
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 
MYSql manage db
MYSql manage dbMYSql manage db
MYSql manage db
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Module02
Module02Module02
Module02
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
MS SQL Server
MS SQL ServerMS SQL Server
MS SQL Server
 
QSpiders - Interacting with My SQL Database
QSpiders - Interacting with My SQL DatabaseQSpiders - Interacting with My SQL Database
QSpiders - Interacting with My SQL Database
 
ms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptxms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptx
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
 
Mangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.pptMangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.ppt
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
 

More from Subhasis Nayak

Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)
Subhasis Nayak
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
Subhasis Nayak
 
Jsp 01
Jsp 01Jsp 01
Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003
Subhasis Nayak
 
Php, mysq lpart1
Php, mysq lpart1Php, mysq lpart1
Php, mysq lpart1
Subhasis Nayak
 
Php, mysqlpart2
Php, mysqlpart2Php, mysqlpart2
Php, mysqlpart2
Subhasis Nayak
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
Subhasis Nayak
 
Servlet & jsp
Servlet  &  jspServlet  &  jsp
Servlet & jsp
Subhasis Nayak
 
J2ee connector architecture
J2ee connector architectureJ2ee connector architecture
J2ee connector architecture
Subhasis Nayak
 
how to create object
how to create objecthow to create object
how to create object
Subhasis Nayak
 
Pointer in c++ part3
Pointer in c++ part3Pointer in c++ part3
Pointer in c++ part3
Subhasis Nayak
 
Pointer in c++ part2
Pointer in c++ part2Pointer in c++ part2
Pointer in c++ part2
Subhasis Nayak
 
C++ arrays part2
C++ arrays part2C++ arrays part2
C++ arrays part2
Subhasis Nayak
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
Subhasis Nayak
 
Introduction to network
Introduction to networkIntroduction to network
Introduction to network
Subhasis Nayak
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
Subhasis Nayak
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
Subhasis Nayak
 
Text mode Linux Installation Part 01
Text mode Linux Installation Part 01Text mode Linux Installation Part 01
Text mode Linux Installation Part 01
Subhasis Nayak
 

More from Subhasis Nayak (20)

Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)
 
Php, mysq lpart3
Php, mysq lpart3Php, mysq lpart3
Php, mysq lpart3
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003
 
Php, mysq lpart1
Php, mysq lpart1Php, mysq lpart1
Php, mysq lpart1
 
Php, mysqlpart2
Php, mysqlpart2Php, mysqlpart2
Php, mysqlpart2
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 
Servlet & jsp
Servlet  &  jspServlet  &  jsp
Servlet & jsp
 
J2ee connector architecture
J2ee connector architectureJ2ee connector architecture
J2ee connector architecture
 
how to create object
how to create objecthow to create object
how to create object
 
Pointer in c++ part3
Pointer in c++ part3Pointer in c++ part3
Pointer in c++ part3
 
Pointer in c++ part2
Pointer in c++ part2Pointer in c++ part2
Pointer in c++ part2
 
Pointer in c++ part1
Pointer in c++ part1Pointer in c++ part1
Pointer in c++ part1
 
C++ arrays part2
C++ arrays part2C++ arrays part2
C++ arrays part2
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
 
Introduction to network
Introduction to networkIntroduction to network
Introduction to network
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
 
Text mode Linux Installation Part 01
Text mode Linux Installation Part 01Text mode Linux Installation Part 01
Text mode Linux Installation Part 01
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

working with database using mysql

  • 1. Let’s work with Database (MySql) Author:- Subhasis CMC
  • 2. MySql & RDBMS • MySQL is a Relational Database Management System (RDBMS). • server can manage many databases at the same time. • In fact many people might have different databases managed by a single MySQL server. • Each database consists of a structure to hold the data and the data itself. • A database can exist without data.
  • 3. Cont’d ….. • Data in a database is stored in one or more tables.
  • 4. Cont’d …. • First you create the empty database. • Then you add empty tables to the database. • Table is organized with in rows and columns. • Each row represents an entity in the database • Each column contains an item of information about the entity. • The place where a particular row and column intersect, the individual cell of the table, is called a field.
  • 5. Cont’d ….. • Tables in databases can be related. • Often a row in one table is related to several rows in another table. • You include a column in one table to hold data that matches data in the column of another table.
  • 7. Communicating with DataBase • All our interaction with the database is accomplished by passing messages to the MySQL server. • It must be able to understand the instructions that you send it. • So we communicate using Structured Query Language (SQL), which is a standard computer language understood by most database management systems
  • 8. Cont’d ….. • To make a request that MySQL can understand, you build an SQL query and send it to the MySQL server.
  • 9. Building SQL queries • The first word of each query is its name name, which is an action word (a verb) that tells MySQL what we want to do. • Queries we discuss here: ▫ CREATE ▫ DROP ▫ ALTER ▫ SHOW ▫ INSERT ▫ LOAD ▫ SELECT ▫ UPDATE ▫ DELETE
  • 10. Cont’d …. • The query name is followed by words and phrases — some required and some optional — that tell MySQL how to perform the action. • For insntace we have to tell the table name to which we want to insert the data.
  • 11. Don’t forget • SQL language words in all caps. • SQL words must be separated by one or more spaces. • Put the string within double quote.
  • 12. Sending SQL query • We can send sql query to do what we desire to do using: ▫ The mysql client - A text-based mysql client is automatically installed when we install MYSQL. ▫ Administration software - Separate software packages that are available can provide a more user- friendly interface for interacting with MySQL than the mysql client does. ▫ PHP built in function –we communicate with a MySQL database from PHP scripts by using PHP built- in functions designed specifically for this purpose.
  • 13. Using the mysql client • To send SQL queries to MySQL from the mysql client, follow these steps: A. Locate the mysql client(it is in bin of your mysql directory) we can start it fom Command prompt of Windows B. To start command is (mysql -u root -p) C. If you are in network then you need command (mysql -h mysqlhost.mycompany.com -u root -p) D. At the mysql prompt, type your SQL query followed by a semicolon (;) and then press Enter. E. To leave the mysql client, type quit at the prompt and then press Enter.
  • 14. Using Administration software • To work with mySql using admin software We need these steps as follow: A. Open your browser and access the phpMyAdmin main page.(localhost:Portnumber/phpmyadmin) B. Click the down arrow in the databases field in the left pane of the phpMyAdmin page. Click the name of the database you want to open. C. Click the SQL link near the top center of the page. D. Type your SQL query in the text area E. Click Go below the query text area.
  • 15. Protect Ur DB before hacked • MySQL accounts: No one can access the data in your database without an account. Sp protect ur database with a strong password. • Permissions: MySQL uses account permissions to specify who can do what. Differentiate the tasks using different user name and password for different tasks.
  • 17. Field • The individual cell in which a particular row and column intersect is called a field.
  • 18. Better to be organized • The table name should clearly identify the objects that it contains with a descriptive word or term. • Column name must speaks about hat will be filled in it. • Name of column and table is case sensitive. • Identify the primary key
  • 20. Creating table • To cretae table we need CREATE TABLE command as follows. CREATE TABLE table_name ( column_name NOT NULL PRIMARY KEY, column_name VARCHAR(37) NOT NULL, column_name VARCHAR(2) NULL );
  • 21. SELECT command • To fetch / read data we need SELECT command. • We will search the record and show them using SELECT command. SELECT * from employee; • To search something specific we need WHERE clause. SELECT * from employee WHERE designation=‘manager’;
  • 22. Where to put single quote
  • 23. ORDER BY • ORDER BY clause is to ensure that the result set produced by the query is returned in the specified sequence. Simply, ORDER BY sorts the results. • Following the ORDER BY keywords is at least one column with an optional ASC (ascending) or DESC (descending) keyword; if neither is specified, ascending is the default. ORDER BY column [ASC | DESC] [, column [ASC | DESC]] ⋮
  • 24. INSERT command • The INSERT statement inserts one or more rows. INSERT INTO table name (colm1, colm2, colm3..) VALUES (valu1,value2,value3,vlaue4);
  • 25. UPDATE command • The UPDATE DML statement is similar to the ALTER DDL statement in that it produces a change. • The difference is that, whereas ALTER changes the structure of a table, UPDATE changes the data contained within a table, while the table’s structure remains the same. UPDATE table_name SET column_name = ‘value’; UPDATE table_name SET column_name = ‘value’ WHERE column_name=‘value’;
  • 26. DELETE command • The DELETE DML statement is similar to the DROP DDL statement, in that it removes objects from the database. The difference is that DROP removes a table from the database, while DELETE removes entire rows of data from a table, but the table continues to exist. DELETE FROM table_name WHERE column_name = ‘value’;