explain sql statement with example |
What is SQL?
SQl Stands
for Structure Query Language or Sequential query language which in common terms
known as database language where one can store data in an proper order almost permanently
in an sequential order.
There are
many database used by computer programmer or software developer but if you ask
me I personally like SQL Server and MySQL.
I like to
use MySQL with my php projects first of all it’s completely free and other it’s
very easy to handle.
The syntax
used in MySQL is very simple to learn and implement therefore it almost certain
that new students or beginners always prefer MySQL above every database
language.
Also Read ::
There are
some basic to advance query available in MySQL which we are going to learn
below with examples.
Select Query
How select
Query is written in MySQL
Select *
from <table name>
In PHP
$query=”select
* from <table name>”;
Select Query
with where clause
Select *
from <table name> where age>=18
In PHP
$query=”select
* from <table name> where age>18”;
And operator
in MySQL
Select *
from <table name> where age>=18 and sex=”male”
In PHP
$query=”select
* from <table name> where age>=18
and sex=’male’”;
OR clause
Select *
from <table name> where age>=18 or sex=”male”
In PHP
$query=”Select
* from <table name> where age>=18 or sex=”male””;
Delete Query
Delete from
<table name>
In PHP
$query=”delete
from <table name>”;
This query
will delete complete record from the given table to avoid this you will be
needed where clause in the above query.
Delete Query
with where clause
Delete from
<table name> where id=”2”
This query
will specifically delete record from the database where id=2
In PHP
$query=”delete
from <table name> where id=’2’”;
Read More::
https://catchthemes.com/support-forum/users/chtips/
https://speakerdeck.com/chtips
Comments
Post a Comment