Category Archives: SQ L& MYsql

Operators in the where clause

#Example for “=”. select * from mydoubts_table_users where name=’vasanthan’ —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| ——————————————————- #Example for “!=” select * from mydoubts_table_users where name!=’vasanthan’ output —— —————————————————— |id|Name |Age| —————————————————— |2|John |44| |3|Michael |34| |4|Rani |39| |5|Raina |38| |6|Rajendra |25| |7|Sharon |18| ——————————————————- #Example for “>” select * from mydoubts_table_users where age>29 output —— ——————————————————… Read More »

Where query in mysql

Example: select * from mydoubts_table_users where name=’vasanthan’ output —— —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| ——————————————————-

Mysql ‘Select’ query

query example and sample output as below “Select * from mydoubts_table_users output —— —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| |2|John |44| |3|Michael |34| |4|Rani |39| |5|Raina |38| |6|Rajendra |25| |7|Sharon |18| ——————————————————-

‘In’ clause in mysql

‘In’ clause wirll replace many ‘OR’s Example for fetching data using ‘In’. —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| |2|John |44| |3|Michael |34| |4|Rani |39| |5|Raina |38| |6|Rajendra |25| |7|Sharon |18| ——————————————————- Select * from mydoubts_table_users where age IN(34,32,38); —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| |3|Michael |34| |5|Raina |38| ——————————————————- Suppose if we use the query using ‘or’… Read More »

Primarykey in sql

* primarykey uniquely identifies each record in a database table. * primarykey must contain unique values. * primarykey column cannot contain null values. * Each table should have a primarykey and each table have only one primary key.

SQL UNIQUE Constraint

* unique constraint uniquely identifies each record in a database table *unique and primarykey gives a guarantee for uniqueness for cloumn or set of columns. *primarykey automatically has a unique constraint on it *we can have many unique per table *we can have only one primarykey per table.