SlideShare une entreprise Scribd logo
1  sur  37
# MySQL is a relational database management system (RDBMS).  MySQL is currently the most popular open source database server in existence.  # A relational database management system which runs a server, providing multi-user access to a number of databases. # SQL (Structured Query Language) is a standard interactive and programming language for getting information from and updating a database.  MY SQL
# Structured Query Langauge is cross between a math-like language and an English-like language that allows us to ask a database questions or tell it do do things. For example: SELECT * FROM table; Where 'SELECT', 'FROM' and 'table' are in English, but '*' is a symbol that means all.
*USES: ,[object Object]
  Its popularity for use with web applications is closely tied to the popularity of  PHP , which is often combined with MySQL.
Several high-traffic web sites including  Flickr, Facebook, Wikipedia, Google, Nokia and YouTube  use MySQL for data storage and logging of user data.
CREATE Command - is used to  create  a database/table. ,[object Object]
DELETE Command - is used to  delete  data from the database.
INSERT Command - is used to  insert  data into a database.
UPDATE Command - is used to  update  the data in a table.
DROP Command - is used to  delete or drop  the database/table.  . BASIC QUERIES COMMANDS
CREATE Command : The Create command is used to create a table by specifying the tablename, fieldnames and constraints. Syntax: $createSQL=("CREATE TABLE tblName"); Example: $createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");
SELECT Command: The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command.  Syntax: $selectSQL=("SELECT field_names FROM tablename"); Example: $selectSQL=("SELECT * FROM tblstudent");
DELETE Comman d: The Delete command is used to delete the records from a table using conditions as shown below: Syntax: $deleteSQL=("DELETE * FROM tablename WHERE condition"); Example: $deleteSQL=("DELETE * FROM tblstudent WHERE fldstudid=2");
INSERT Command: The Insert command is used to insert records into a table. The values are assigned to the field names as shown below: Syntax : $insertSQL=("INSERT INTO tblname(fieldname1,fieldname2..) VALUES(value1,value2,...) "); Example: $insertSQL=("INSERT INTO Tblstudent(fldstudName,fldstudmark)VALUES(Baskar,75) ");
UPDATE Command: The Update command is used to update the field values using conditions. This is done using 'SET' and the fieldnames to assign new values to them. Syntax: $updateSQL=("UPDATE Tblname SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber"); Example :$updateSQL=("UPDATE Tblstudent SET (fldstudName=siva,fldstudmark=100) WHERE fldstudid=2");
DROP Command: The Drop command is used to delete all the records in a table using the table name as shown below:  Syntax: $dropSQL=("DROP tblName"); Example : $dropSQL=("DROP tblstudent");
Advanced functions and queries that can be useful when building more complex applications. *INNER JOIN: INNER JOIN is used to retrieve the data from all tables listed based on condition listed after keyword ON. If the condition is not meet, nothing is returned.  For Eg:  We have employees table and offices table. Two tables are linked together by the column officeCode.  ADVANCED QUERIES
To find out who is in which country and state we can use INNER JOIN to join these tables. Here is the SQL code: SELECT employees.firstname, employees.lastname, offices.country, offices.state FROM employees INNER JOIN offices  ON offices.officeCode = employees.officeCode
REPLACE: The REPLACE function searches a character string and replaces characters found in search string with characters listed in replacement Str.  Syntax : REPLACE(character_string,search_string, replacement_string) * character_string ->the string to be searched. * search_string -> the string of one or more characters to be found in chr String.  *  replacement_string ->the string that replaces any occurrences of search_string that are found in character_string.
Example: R eplaces hyphens (dashes) found in a person’s phone number with periods. SELECT PERSON_PHONE, REPLACE(PERSON_PHONE,'-','.') AS  DISPLAY_PHONE  FROM PERSON; PERSON_PHONE  DISPLAY_PHONE ---------------  --------------- 230-229-8976  230.229.8976 401-617-7297  401.617.7297
LTRIM  The LTRIM function removes any leading (left-hand) spaces in a character string.Only leading spaces are removed—embedded and trailing spaces are left in the string.  Eg: LTRIM (' String with spaces ') Returns this string: 'String with spaces '
RTRIM The RTRIM function works like LTRIM, but it removes trailing spaces. If we need to remove both leading and trailing spaces, you can nest LTRIM and RTRIM like this: Eg:RTRIM(LTRIM (' String with spaces ')) Returns this string: 'String with spaces'
SIGN  The SIGN function takes in a numeric expression and returns one of the following values based on the sign of the input number: Return Value   Meaning − 1 Input number is negative   0 Input number is zero   1 Input number is positive Null Input number is null
Eg :SELECT LATE_OR_LOSS_FEE, SIGN(LATE_OR_LOSS_FEE) AS FEE_SIGN FROM MOVIE_RENTAL WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE FEE_SIGN  29.99  1   4  1   4  1   29.98  1
SQRT  The SQRT function takes in a single numeric expression and returns its square root. The general syntax is  SQRT (numeric_expression) The result is a bit meaningless, but let’s take the square root of the non-null Late or Loss Fees we just looked at:
SELECT LATE_OR_LOSS_FEE,         SQRT(LATE_OR_LOSS_FEE) AS FEE_SQRT    FROM MOVIE_RENTAL   WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE    FEE_SQRT ----------------  ----------             29.99  5.47631263                 4           2                 4           2             29.98  5.47539953
*CEILING (CEIL)  The CEILING function returns the smallest integer that is greater than or equal to the value of the numeric expression provided as an input parameter. In other words, it  rounds up to the next nearest whole number.
As an example,  SELECT LATE_OR_LOSS_FEE, CEILING(LATE_OR_LOSS_FEE) AS FEE_CEILING FROM MOVIE_RENTAL WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE  FEE_CEILING 4.00  4 4.00  4 29.99  30
FLOOR  The FLOOR function is the  logical opposite of the CEILING function —it returns the integer that is less than or equal to the value of the numeric expression provided as an input parameter. In other words,  it rounds down to the next nearest whole number.
Example showing FLOOR applied to Late or Loss SELECT LATE_OR_LOSS_FEE,         FLOOR(LATE_OR_LOSS_FEE) AS FEE_FLOOR    FROM MOVIE_RENTAL   WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE  FEE_FLOOR              4.00          4             29.99         29             29.98         29
Date and Time: Function   Purpose   Input Parameters ADD_MONTHS   Adds the supplied number of months to the supplied date   date, number  ofmonths (positive or  negative value) CURRENT_DATE   Returns the current date in the time zone set for the None   database session EXTRACT  Extracts the specified datetime field from the supplied date  datetime field  keyword, date LAST_DAY    Returns the supplied date with the day shifted to the last day  date   of the month
[object Object]
MySQL supports "routines" and there are two kinds of routines: stored procedures  or functions whose return values we use in other SQL statements.
A stored procedure has a name, a parameter list, and an SQL statement, which can contain many more SQL statements. PROCEDURES
CREATE PROCEDURE Syntax: The general syntax of Creating a Stored Procedure is : CREATE PROCEDURE proc_name ([proc_parameter[......]]) routine_body *proc_name : procedure name *proc_parameter : [ IN | OUT | INOUT ]  param_name type *routine_body : Valid SQL procedure statement *An IN parameter is used to pass the value into a procedure. *An INOUT parameter is initialized by the caller and it can be modified by the  procedure.
[object Object]
We can define simple functions that operate on a single row at a time, or aggregate functions that operate on groups of rows.

Contenu connexe

Tendances

Oracle tips and tricks
Oracle tips and tricksOracle tips and tricks
Oracle tips and tricksYanli Liu
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 14
Oracle - Program with PL/SQL - Lession 14Oracle - Program with PL/SQL - Lession 14
Oracle - Program with PL/SQL - Lession 14Thuan Nguyen
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideSrinimf-Slides
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Thuan Nguyen
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql SyntaxReka
 
Oracle PL/SQL Bulk binds
Oracle PL/SQL Bulk bindsOracle PL/SQL Bulk binds
Oracle PL/SQL Bulk bindsScott Wesley
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries Prabu Cse
 
Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17Thuan Nguyen
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sqlnaveen
 

Tendances (20)

Oracle tips and tricks
Oracle tips and tricksOracle tips and tricks
Oracle tips and tricks
 
Les01
Les01Les01
Les01
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07
 
Oracle - Program with PL/SQL - Lession 14
Oracle - Program with PL/SQL - Lession 14Oracle - Program with PL/SQL - Lession 14
Oracle - Program with PL/SQL - Lession 14
 
Sql
SqlSql
Sql
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step Guide
 
Les09
Les09Les09
Les09
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
My sql
My sqlMy sql
My sql
 
Foxpro (1)
Foxpro (1)Foxpro (1)
Foxpro (1)
 
Oracle PL/SQL Bulk binds
Oracle PL/SQL Bulk bindsOracle PL/SQL Bulk binds
Oracle PL/SQL Bulk binds
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01
 
Oracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guideOracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guide
 
Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05
 
Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17
 
Best sql plsql material
Best sql plsql materialBest sql plsql material
Best sql plsql material
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 

En vedette

Con
ConCon
ConReka
 
Php1(2)
Php1(2)Php1(2)
Php1(2)Reka
 
Lamp1
Lamp1Lamp1
Lamp1Reka
 
Online classifieds
Online classifiedsOnline classifieds
Online classifiedsTori.fi
 
E-CLASSIFIEDS
E-CLASSIFIEDSE-CLASSIFIEDS
E-CLASSIFIEDSReka
 
Online shopping ppt by rohit jain
Online shopping ppt by rohit jainOnline shopping ppt by rohit jain
Online shopping ppt by rohit jainRohit Jain
 

En vedette (8)

YP logo 1
YP logo 1YP logo 1
YP logo 1
 
Con
ConCon
Con
 
Php1(2)
Php1(2)Php1(2)
Php1(2)
 
Lamp1
Lamp1Lamp1
Lamp1
 
Online classifieds
Online classifiedsOnline classifieds
Online classifieds
 
E-CLASSIFIEDS
E-CLASSIFIEDSE-CLASSIFIEDS
E-CLASSIFIEDS
 
PHP Project PPT
PHP Project PPTPHP Project PPT
PHP Project PPT
 
Online shopping ppt by rohit jain
Online shopping ppt by rohit jainOnline shopping ppt by rohit jain
Online shopping ppt by rohit jain
 

Similaire à Mysqlppt (20)

My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 
Mysql Ppt
Mysql PptMysql Ppt
Mysql Ppt
 
Unit 2 web technologies
Unit 2 web technologiesUnit 2 web technologies
Unit 2 web technologies
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Module04
Module04Module04
Module04
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
 
Les08-Oracle
Les08-OracleLes08-Oracle
Les08-Oracle
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Dbms
DbmsDbms
Dbms
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 

Plus de Reka

Linuxppt
LinuxpptLinuxppt
LinuxpptReka
 
Apache doc
Apache docApache doc
Apache docReka
 
Lamp
LampLamp
LampReka
 
Apache ppt
Apache pptApache ppt
Apache pptReka
 
Php1
Php1Php1
Php1Reka
 
Apache doc
Apache docApache doc
Apache docReka
 
My sql Commands
My sql CommandsMy sql Commands
My sql CommandsReka
 
My sql
My sql My sql
My sql Reka
 
Aj
AjAj
AjReka
 
Linux cmd
Linux cmdLinux cmd
Linux cmdReka
 
Lamp ppt
Lamp pptLamp ppt
Lamp pptReka
 
APACHE
APACHEAPACHE
APACHEReka
 
LINUX
LINUXLINUX
LINUXReka
 
LAMP
LAMPLAMP
LAMPReka
 

Plus de Reka (14)

Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Apache doc
Apache docApache doc
Apache doc
 
Lamp
LampLamp
Lamp
 
Apache ppt
Apache pptApache ppt
Apache ppt
 
Php1
Php1Php1
Php1
 
Apache doc
Apache docApache doc
Apache doc
 
My sql Commands
My sql CommandsMy sql Commands
My sql Commands
 
My sql
My sql My sql
My sql
 
Aj
AjAj
Aj
 
Linux cmd
Linux cmdLinux cmd
Linux cmd
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
APACHE
APACHEAPACHE
APACHE
 
LINUX
LINUXLINUX
LINUX
 
LAMP
LAMPLAMP
LAMP
 

Dernier

Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girlsmodelanjalisharma4
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdftbatkhuu1
 
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...nagunakhan
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...Suhani Kapoor
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxTusharBahuguna2
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...ranjana rawat
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130Suhani Kapoor
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Roomdivyansh0kumar0
 
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...nagunakhan
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiVIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiSuhani Kapoor
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CANestorGamez6
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 

Dernier (20)

Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...
Punjabi Housewife Call Girls Service Gomti Nagar \ 9548273370 Indian Call Gir...
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
 
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
 
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiVIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
 
B. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdfB. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdf
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 

Mysqlppt

  • 1. # MySQL is a relational database management system (RDBMS). MySQL is currently the most popular open source database server in existence. # A relational database management system which runs a server, providing multi-user access to a number of databases. # SQL (Structured Query Language) is a standard interactive and programming language for getting information from and updating a database. MY SQL
  • 2. # Structured Query Langauge is cross between a math-like language and an English-like language that allows us to ask a database questions or tell it do do things. For example: SELECT * FROM table; Where 'SELECT', 'FROM' and 'table' are in English, but '*' is a symbol that means all.
  • 3.
  • 4. Its popularity for use with web applications is closely tied to the popularity of PHP , which is often combined with MySQL.
  • 5. Several high-traffic web sites including Flickr, Facebook, Wikipedia, Google, Nokia and YouTube use MySQL for data storage and logging of user data.
  • 6.
  • 7. DELETE Command - is used to delete data from the database.
  • 8. INSERT Command - is used to insert data into a database.
  • 9. UPDATE Command - is used to update the data in a table.
  • 10. DROP Command - is used to delete or drop the database/table. . BASIC QUERIES COMMANDS
  • 11. CREATE Command : The Create command is used to create a table by specifying the tablename, fieldnames and constraints. Syntax: $createSQL=("CREATE TABLE tblName"); Example: $createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");
  • 12. SELECT Command: The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command. Syntax: $selectSQL=("SELECT field_names FROM tablename"); Example: $selectSQL=("SELECT * FROM tblstudent");
  • 13. DELETE Comman d: The Delete command is used to delete the records from a table using conditions as shown below: Syntax: $deleteSQL=("DELETE * FROM tablename WHERE condition"); Example: $deleteSQL=("DELETE * FROM tblstudent WHERE fldstudid=2");
  • 14. INSERT Command: The Insert command is used to insert records into a table. The values are assigned to the field names as shown below: Syntax : $insertSQL=("INSERT INTO tblname(fieldname1,fieldname2..) VALUES(value1,value2,...) "); Example: $insertSQL=("INSERT INTO Tblstudent(fldstudName,fldstudmark)VALUES(Baskar,75) ");
  • 15. UPDATE Command: The Update command is used to update the field values using conditions. This is done using 'SET' and the fieldnames to assign new values to them. Syntax: $updateSQL=("UPDATE Tblname SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber"); Example :$updateSQL=("UPDATE Tblstudent SET (fldstudName=siva,fldstudmark=100) WHERE fldstudid=2");
  • 16. DROP Command: The Drop command is used to delete all the records in a table using the table name as shown below: Syntax: $dropSQL=("DROP tblName"); Example : $dropSQL=("DROP tblstudent");
  • 17. Advanced functions and queries that can be useful when building more complex applications. *INNER JOIN: INNER JOIN is used to retrieve the data from all tables listed based on condition listed after keyword ON. If the condition is not meet, nothing is returned. For Eg: We have employees table and offices table. Two tables are linked together by the column officeCode. ADVANCED QUERIES
  • 18. To find out who is in which country and state we can use INNER JOIN to join these tables. Here is the SQL code: SELECT employees.firstname, employees.lastname, offices.country, offices.state FROM employees INNER JOIN offices ON offices.officeCode = employees.officeCode
  • 19. REPLACE: The REPLACE function searches a character string and replaces characters found in search string with characters listed in replacement Str. Syntax : REPLACE(character_string,search_string, replacement_string) * character_string ->the string to be searched. * search_string -> the string of one or more characters to be found in chr String. * replacement_string ->the string that replaces any occurrences of search_string that are found in character_string.
  • 20. Example: R eplaces hyphens (dashes) found in a person’s phone number with periods. SELECT PERSON_PHONE, REPLACE(PERSON_PHONE,'-','.') AS DISPLAY_PHONE FROM PERSON; PERSON_PHONE DISPLAY_PHONE --------------- --------------- 230-229-8976 230.229.8976 401-617-7297 401.617.7297
  • 21. LTRIM The LTRIM function removes any leading (left-hand) spaces in a character string.Only leading spaces are removed—embedded and trailing spaces are left in the string. Eg: LTRIM (' String with spaces ') Returns this string: 'String with spaces '
  • 22. RTRIM The RTRIM function works like LTRIM, but it removes trailing spaces. If we need to remove both leading and trailing spaces, you can nest LTRIM and RTRIM like this: Eg:RTRIM(LTRIM (' String with spaces ')) Returns this string: 'String with spaces'
  • 23. SIGN The SIGN function takes in a numeric expression and returns one of the following values based on the sign of the input number: Return Value Meaning − 1 Input number is negative 0 Input number is zero 1 Input number is positive Null Input number is null
  • 24. Eg :SELECT LATE_OR_LOSS_FEE, SIGN(LATE_OR_LOSS_FEE) AS FEE_SIGN FROM MOVIE_RENTAL WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE FEE_SIGN 29.99 1 4 1 4 1 29.98 1
  • 25. SQRT The SQRT function takes in a single numeric expression and returns its square root. The general syntax is SQRT (numeric_expression) The result is a bit meaningless, but let’s take the square root of the non-null Late or Loss Fees we just looked at:
  • 26. SELECT LATE_OR_LOSS_FEE,        SQRT(LATE_OR_LOSS_FEE) AS FEE_SQRT   FROM MOVIE_RENTAL   WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE    FEE_SQRT ----------------  ----------            29.99  5.47631263                4           2                4           2            29.98  5.47539953
  • 27. *CEILING (CEIL) The CEILING function returns the smallest integer that is greater than or equal to the value of the numeric expression provided as an input parameter. In other words, it rounds up to the next nearest whole number.
  • 28. As an example, SELECT LATE_OR_LOSS_FEE, CEILING(LATE_OR_LOSS_FEE) AS FEE_CEILING FROM MOVIE_RENTAL WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE FEE_CEILING 4.00 4 4.00 4 29.99 30
  • 29. FLOOR The FLOOR function is the logical opposite of the CEILING function —it returns the integer that is less than or equal to the value of the numeric expression provided as an input parameter. In other words, it rounds down to the next nearest whole number.
  • 30. Example showing FLOOR applied to Late or Loss SELECT LATE_OR_LOSS_FEE,        FLOOR(LATE_OR_LOSS_FEE) AS FEE_FLOOR   FROM MOVIE_RENTAL   WHERE LATE_OR_LOSS_FEE IS NOT NULL; LATE_OR_LOSS_FEE  FEE_FLOOR             4.00          4            29.99         29            29.98         29
  • 31. Date and Time: Function Purpose Input Parameters ADD_MONTHS Adds the supplied number of months to the supplied date date, number ofmonths (positive or negative value) CURRENT_DATE Returns the current date in the time zone set for the None database session EXTRACT Extracts the specified datetime field from the supplied date datetime field keyword, date LAST_DAY Returns the supplied date with the day shifted to the last day date of the month
  • 32.
  • 33. MySQL supports "routines" and there are two kinds of routines: stored procedures or functions whose return values we use in other SQL statements.
  • 34. A stored procedure has a name, a parameter list, and an SQL statement, which can contain many more SQL statements. PROCEDURES
  • 35. CREATE PROCEDURE Syntax: The general syntax of Creating a Stored Procedure is : CREATE PROCEDURE proc_name ([proc_parameter[......]]) routine_body *proc_name : procedure name *proc_parameter : [ IN | OUT | INOUT ] param_name type *routine_body : Valid SQL procedure statement *An IN parameter is used to pass the value into a procedure. *An INOUT parameter is initialized by the caller and it can be modified by the procedure.
  • 36.
  • 37. We can define simple functions that operate on a single row at a time, or aggregate functions that operate on groups of rows.
  • 38. Information is provided to functions that enables them to check the number, types, and names of the arguments passed to them. FUNCTIONS
  • 39. CREATE FUNCTION Syntax: The general syntax of Creating a Function is :         CREATE FUNCTION func_name ([func_parameter[,...]]) RETURNS type routine_body func_name : Function name func_paramete r : param_name type type : Any valid MySQL datatype routine_body : Valid SQL procedure statement The RETURN clause is mandatory for FUNCTION. It used to indicate the return type of function.
  • 40.
  • 41. MySQL IN Clause - This is a clause which can be used alongwith any MySQL query to specify a condition.
  • 42. MySQL BETWEEN Clause - This is a clause which can be used to specify a condition.
  • 43. MySQL UNION Keyword - Use a UNION operation to combine multiple result sets into one. MySQL COUNT Function - The MySQL COUNT aggregate function is used to count the number of rows in a database table. MySQL MAX Function - The MySQL MAX aggregate function allows us to select the highest (maximum) value for a certain column.
  • 44. MySQL RAND Function - This is used to generate a random number using MySQL command. MySQL CONCAT Function - This is used to concatenate any string inside any MySQL command. MySQL DATE and Time Functions - Complete list of MySQL Date and Time related functions.
  • 45. MySQL MIN Function - The MySQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column. MySQL AVG Function - The MySQL AVG aggregate function selects the average value for certain table column. MySQL SUM Function - The MySQL SUM aggregate function allows selecting the total for a numeric column. MySQL SQRT Functions - This is used to generate a square root of a given number.
  • 46. What's the Difference Between a Stored Procedure and a Stored Function? The difference between a stored procedures and stored functions is the same as the difference between a subroutine and a function: * a stored procedure runs some code * a stored function runs some code and then returns a result
  • 47. Why Use Stored Procedures and Stored Functions? The real advantage to using stored procedures and stored functions is that they provide functionality which is platform and application independant.
  • 48. It can be used to back up a database or to move database information from one server to another. 1.Export A MySQL Database: This example shows how to export a database. It is a good idea to export the data often as a backup. # mysqldump -u username -ppassword database_name > FILE.sql Replace username, password and database_name with your MySQL username, password and database name.File FILE.sql now holds a backup of your database, download it to your computer. IMPORT AND EXPORT
  • 49. 2. Import A MySQL Database: Here, we import a database. Using this to restore data from a backup or to import from another MySQL server. Start by uploading the FILE.sql file to the server where we will be running this command. # mysql -u username -ppassword database_name < FILE.sql