SlideShare a Scribd company logo
1 of 17
PHP FILES
SUBMITTED BY:
S.N.SWETHA
PHP FILES
OPENING FILES:
The PHP f open() function is used to open a file. It
requires two arguments stating first the file name and
then mode in which to operate.
Files modes can be specified as one of the six options
in this table.
S.NO MODE&PUURPOSE
1 r
Opens the file for reading only.
Places the file pointer at the beginning of the file.
2 r+
Opens the file for reading and writing.
Places the file pointer at the beginning of the file
3 W
Opens the file for writing only.
Places the file pointer at the beginning of the file
and truncates the file to zero length.
4 w+
Opens the file for reading and writing only.
Places the file pointer at the beginning of the file.
and truncates the file to zero length.
5 a
Opens the file for writing only.
Places the file pointer at the end of the file.
If files does not exist then it attempts to create a file.
6 a+
CLOSING FILES:
After making a changes to the opened file it is important to close it
with the f close() function. The f close() function requires a file
pointer as its argument and then returns true when the closure
succeeds or false if it fails.
READING A FILES:
Once a file is opened using f open() function it can be read
with a function called f read(). This function requires two
arguments. These must be the file pointer and the length of the
file expressed in bytes.
The files length can be found using the file size() function
which takes the file name as its argument and returns the size
of the file expressed in bytes.
So here are the steps required to read a file with PHP.
 Open a file using f open() function.
 Get the file's length using file size() function.
 Read the file's content using f read() function.
 Close the file with f close() function.
WRITING A FILE:
A new file can be written or text can be appended to an existing file
using the PHP f write() function. This function requires two arguments
specifying a file pointer and the string of data that is to be written.
Optionally a third integer argument can be included to specify the
length of the data to write. If the third argument is included, writing
would will stop after the specified length has been reached.
MY SQL DATABASE
MY SQL DATABASE:
INSERT:
To insert data into a My SQL table, you would need to use the
SQL INSERT INTO command. You can insert data into the
My SQL table by using the my sql > prompt or by using any
script like PHP.
Syntax:
INSERT INTO table name ( field1, field2,...field N )
VALUES
( value1, value2,...value N );
INSERTING DATA FROM THE COMMAND PROMPT:
To insert data from the command prompt, we will use SQL
INSERT INTO command to insert data into My SQL table tutorial
table.
My SQL prompt while pressing the enter key without giving a
semicolon at the end of each line of the command.
EXAMPLE:
we have not provided a tutorial _ id because at the time of table
creation, we had given AUTO_INCREMENT option for this field. So
My SQL takes care of inserting these IDs automatically.
Here, NOW() is a My NSQL function, which returns the current date
and time.
UPDATE:
There may be a requirement where the existing data in a My SQL table
needs to be modified. You can do so by using the
SQL UPDATE command. This will modify any field value of any My
SQL table.
Syntax:
UPDATE table _ name SET field1 = new-value1,field2 = new-value2
[WHERE Clause]
DELETE:
If you want to delete a record from any My SQL table, then you can
use the SQL command DELETE FROM. You can use this command
at the my sql > prompt as well as in any script like PHP.
Syntax:
DELETE FROM table _ name [WHERE Clause]
JOIN:
You can use JOINS in the SELECT, UPDATE and DELETE
statements to join the My SQL tables. We will see an example of
the LEFT JOIN also which is different from the simple My SQL
JOIN.
My SQL LEFT JOIN:
A My SQL left join is different from a simple join. A My SQL LEFT
JOIN gives some extra consideration to the table that is on the left.
If I do a LEFT JOIN, I get all the records that match in the same way
and IN ADDITION I get an extra record for each unmatched record in
the left table of the join: thus ensuring (in my example) that every
AUTHOR gets a mention.
GROUP BY:
The SQL GROUP BY clause is used in collaboration with the
SELECT statement to arrange identical data into groups. This GROUP
BY clause follows the WHERE clause in a SELECT statement and
precedes the ORDER BY clause.
Syntax:
SELECT column1, column2
FROM table _ name
WHERE [ conditions ]
GROUP BY column1, column2
ORDER BY column1, column2
AGGREGATE FUNCTION:
Aggregate functions in DBMS take multiple rows from
the table and return a value according to the query.
All the aggregate functions are used in Select statement.
Syntax:
SELECT <FUNCTION NAME> (<PARAMETER>)
FROM <TABLE NAME>
AVG Function:
 This function returns the average value of the numeric
column that is supplied as a parameter.
Example: Write a query to select average salary from
employee table.
Select AVG(salary) from Employee
COUNT Function:
The count function returns the number of rows in the
result. It does not count the null values.
Example: Write a query to return number of rows where salary >
20000.
Select COUNT(*) from Employee where Salary > 20000;
Types:
COUNT(*): Counts all the number of rows of the table including
null.
COUNT( COLUMN_NAME): count number of non-null values in
column.
COUNT( DISTINCT COLUMN_NAME): count number of distinct
values in a column.
MAX Function:
The MAX function is used to find maximum value in the column
that is supplied as a parameter. It can be used on any type of data.
Example: Write a query to find the maximum salary in employee
table.
Select MAX(salary) from Employee
SUM Function:
This function sums up the values in the column supplied as a
parameter.
Example: Write a query to get the total salary of employees.
 Select SUM(salary) from Employee
STDDEV Function:
The STDDEV function is used to find standard deviation of the
column specified as argument.
Example: Write a query to find standard deviation of salary in
Employee table.
 Select STDDEV(salary) from Employee
VARIANCE Function:
The VARIANCE Function is used to find variance of the column
specified as argument.
Example:
 Select VARIANCE(salary) from Employee
FORMAT:
Here Format Name represents the name of the format. The field
line is the specific way, the data should be formatted. The values lines
represent the values that will be entered into the field line. You end the
format with a single period.
Syntax:
Format Name = Field line;
Value _ one, value _ two, value _ three
Field line
Value _ one, value _ two.
USING THE FORMAT:
In order to invoke this format declaration, we would use
the write keyword −
 write EMPLOYEE;
The problem is that the format name is usually the name of an open
file handle, and the write statement will send the output to this file
handle. As we want the data sent to the STDOUT, we must associate
EMPLOYEE with the STDOUT filehandle. First, however, we must
make sure that that STDOUT is our selected file handle, using the
select() function.
 select(STDOUT);
We would then associate EMPLOYEE with STDOUT by setting the
new format name with STDOUT, using the special variable $~ or
$FORMAT_NAME as follows −
 $~ = "EMPLOYEE";
CASE STUDIES:
My SQL Enterprise:
 Z-appos Uses My SQL to Power its Growth & Exceptional Customer Service
 Booking.com Serves One Million Visitors per Day with My SQL Enterprise
Unlimited
 Click ability Dramatically Improves Performance and Scalability with My SQL
Query Analyzer
My SQL Embedded Server:
 My SQL Helps Simply Accounting by Sage Increase Revenue, Market Share, and
Customer Satisfaction
 Con-ceiviums Relies on My SQL to Perform Real-Time Analytics for BlackBerry
Enterprise Server
 Adobe Relies on My SQL to Make Creative Professionals More Productive
My SQL Cluster:
 My SQL Cluster Powers Leading Mobile Media Publishing Platform
 Cash point Saves Half a Million Euros per Year as it Bets on My SQL
 Shopatrons uses My SQL Cluster to Power its Rapidly Growing e-Commerce
Service
 Plus net Achieves Continuous Availability of AAA Services with My SQL Cluster
 Alcatel-Lucent uses My SQL Cluster Carrier Grade Edition to Handle over 60
million Subscribers
THANK YOU

More Related Content

What's hot

What's hot (19)

Commands
CommandsCommands
Commands
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL)
 
Import and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R StudioImport and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R Studio
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
 
Import and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R StudioImport and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R Studio
 
Sql
SqlSql
Sql
 
Oracle: DDL
Oracle: DDLOracle: DDL
Oracle: DDL
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
235689260 oracle-forms-10g-tutorial
235689260 oracle-forms-10g-tutorial235689260 oracle-forms-10g-tutorial
235689260 oracle-forms-10g-tutorial
 
Proc sql tips
Proc sql tipsProc sql tips
Proc sql tips
 
Linker scripts
Linker scriptsLinker scripts
Linker scripts
 
SQL
SQLSQL
SQL
 
Php
PhpPhp
Php
 
Mysql1
Mysql1Mysql1
Mysql1
 
SQL
SQLSQL
SQL
 

Similar to WEB TECHNOLOGIES Unit 2

Similar to WEB TECHNOLOGIES Unit 2 (20)

My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
11i&r12 difference
11i&r12 difference11i&r12 difference
11i&r12 difference
 
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docxAssg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
 
MA3696 Lecture 9
MA3696 Lecture 9MA3696 Lecture 9
MA3696 Lecture 9
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3
 
Savitch ch 04
Savitch ch 04Savitch ch 04
Savitch ch 04
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Sql loader good example
Sql loader good exampleSql loader good example
Sql loader good example
 
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdfYour 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
 
Matlab Manual
Matlab ManualMatlab Manual
Matlab Manual
 
Python_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptxPython_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptx
 
Sql server ___________session 3(sql 2008)
Sql server  ___________session 3(sql 2008)Sql server  ___________session 3(sql 2008)
Sql server ___________session 3(sql 2008)
 
Introduction to MySQL - Part 2
Introduction to MySQL - Part 2Introduction to MySQL - Part 2
Introduction to MySQL - Part 2
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

WEB TECHNOLOGIES Unit 2

  • 2. PHP FILES OPENING FILES: The PHP f open() function is used to open a file. It requires two arguments stating first the file name and then mode in which to operate. Files modes can be specified as one of the six options in this table.
  • 3. S.NO MODE&PUURPOSE 1 r Opens the file for reading only. Places the file pointer at the beginning of the file. 2 r+ Opens the file for reading and writing. Places the file pointer at the beginning of the file 3 W Opens the file for writing only. Places the file pointer at the beginning of the file and truncates the file to zero length. 4 w+ Opens the file for reading and writing only. Places the file pointer at the beginning of the file. and truncates the file to zero length. 5 a Opens the file for writing only. Places the file pointer at the end of the file. If files does not exist then it attempts to create a file. 6 a+
  • 4. CLOSING FILES: After making a changes to the opened file it is important to close it with the f close() function. The f close() function requires a file pointer as its argument and then returns true when the closure succeeds or false if it fails. READING A FILES: Once a file is opened using f open() function it can be read with a function called f read(). This function requires two arguments. These must be the file pointer and the length of the file expressed in bytes. The files length can be found using the file size() function which takes the file name as its argument and returns the size of the file expressed in bytes.
  • 5. So here are the steps required to read a file with PHP.  Open a file using f open() function.  Get the file's length using file size() function.  Read the file's content using f read() function.  Close the file with f close() function. WRITING A FILE: A new file can be written or text can be appended to an existing file using the PHP f write() function. This function requires two arguments specifying a file pointer and the string of data that is to be written. Optionally a third integer argument can be included to specify the length of the data to write. If the third argument is included, writing would will stop after the specified length has been reached.
  • 6. MY SQL DATABASE MY SQL DATABASE: INSERT: To insert data into a My SQL table, you would need to use the SQL INSERT INTO command. You can insert data into the My SQL table by using the my sql > prompt or by using any script like PHP.
  • 7. Syntax: INSERT INTO table name ( field1, field2,...field N ) VALUES ( value1, value2,...value N ); INSERTING DATA FROM THE COMMAND PROMPT: To insert data from the command prompt, we will use SQL INSERT INTO command to insert data into My SQL table tutorial table. My SQL prompt while pressing the enter key without giving a semicolon at the end of each line of the command. EXAMPLE: we have not provided a tutorial _ id because at the time of table creation, we had given AUTO_INCREMENT option for this field. So My SQL takes care of inserting these IDs automatically. Here, NOW() is a My NSQL function, which returns the current date and time.
  • 8. UPDATE: There may be a requirement where the existing data in a My SQL table needs to be modified. You can do so by using the SQL UPDATE command. This will modify any field value of any My SQL table. Syntax: UPDATE table _ name SET field1 = new-value1,field2 = new-value2 [WHERE Clause] DELETE: If you want to delete a record from any My SQL table, then you can use the SQL command DELETE FROM. You can use this command at the my sql > prompt as well as in any script like PHP.
  • 9. Syntax: DELETE FROM table _ name [WHERE Clause] JOIN: You can use JOINS in the SELECT, UPDATE and DELETE statements to join the My SQL tables. We will see an example of the LEFT JOIN also which is different from the simple My SQL JOIN. My SQL LEFT JOIN: A My SQL left join is different from a simple join. A My SQL LEFT JOIN gives some extra consideration to the table that is on the left. If I do a LEFT JOIN, I get all the records that match in the same way and IN ADDITION I get an extra record for each unmatched record in the left table of the join: thus ensuring (in my example) that every AUTHOR gets a mention.
  • 10. GROUP BY: The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. Syntax: SELECT column1, column2 FROM table _ name WHERE [ conditions ] GROUP BY column1, column2 ORDER BY column1, column2
  • 11. AGGREGATE FUNCTION: Aggregate functions in DBMS take multiple rows from the table and return a value according to the query. All the aggregate functions are used in Select statement. Syntax: SELECT <FUNCTION NAME> (<PARAMETER>) FROM <TABLE NAME> AVG Function:  This function returns the average value of the numeric column that is supplied as a parameter. Example: Write a query to select average salary from employee table. Select AVG(salary) from Employee COUNT Function: The count function returns the number of rows in the result. It does not count the null values.
  • 12. Example: Write a query to return number of rows where salary > 20000. Select COUNT(*) from Employee where Salary > 20000; Types: COUNT(*): Counts all the number of rows of the table including null. COUNT( COLUMN_NAME): count number of non-null values in column. COUNT( DISTINCT COLUMN_NAME): count number of distinct values in a column. MAX Function: The MAX function is used to find maximum value in the column that is supplied as a parameter. It can be used on any type of data. Example: Write a query to find the maximum salary in employee table. Select MAX(salary) from Employee
  • 13. SUM Function: This function sums up the values in the column supplied as a parameter. Example: Write a query to get the total salary of employees.  Select SUM(salary) from Employee STDDEV Function: The STDDEV function is used to find standard deviation of the column specified as argument. Example: Write a query to find standard deviation of salary in Employee table.  Select STDDEV(salary) from Employee VARIANCE Function: The VARIANCE Function is used to find variance of the column specified as argument. Example:  Select VARIANCE(salary) from Employee
  • 14. FORMAT: Here Format Name represents the name of the format. The field line is the specific way, the data should be formatted. The values lines represent the values that will be entered into the field line. You end the format with a single period. Syntax: Format Name = Field line; Value _ one, value _ two, value _ three Field line Value _ one, value _ two. USING THE FORMAT: In order to invoke this format declaration, we would use the write keyword −  write EMPLOYEE;
  • 15. The problem is that the format name is usually the name of an open file handle, and the write statement will send the output to this file handle. As we want the data sent to the STDOUT, we must associate EMPLOYEE with the STDOUT filehandle. First, however, we must make sure that that STDOUT is our selected file handle, using the select() function.  select(STDOUT); We would then associate EMPLOYEE with STDOUT by setting the new format name with STDOUT, using the special variable $~ or $FORMAT_NAME as follows −  $~ = "EMPLOYEE";
  • 16. CASE STUDIES: My SQL Enterprise:  Z-appos Uses My SQL to Power its Growth & Exceptional Customer Service  Booking.com Serves One Million Visitors per Day with My SQL Enterprise Unlimited  Click ability Dramatically Improves Performance and Scalability with My SQL Query Analyzer My SQL Embedded Server:  My SQL Helps Simply Accounting by Sage Increase Revenue, Market Share, and Customer Satisfaction  Con-ceiviums Relies on My SQL to Perform Real-Time Analytics for BlackBerry Enterprise Server  Adobe Relies on My SQL to Make Creative Professionals More Productive My SQL Cluster:  My SQL Cluster Powers Leading Mobile Media Publishing Platform  Cash point Saves Half a Million Euros per Year as it Bets on My SQL  Shopatrons uses My SQL Cluster to Power its Rapidly Growing e-Commerce Service  Plus net Achieves Continuous Availability of AAA Services with My SQL Cluster  Alcatel-Lucent uses My SQL Cluster Carrier Grade Edition to Handle over 60 million Subscribers