Drop table
note:if you use drop command then you cant recover the data deleted. drop table mydoubts_table_users
note:if you use drop command then you cant recover the data deleted. drop table mydoubts_table_users
see the examples # delete * from mydoubts_table_users # delete from mydoubts_table_users where name=’vasanthan’
#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 »
Example: select * from mydoubts_table_users where name=’vasanthan’ output —— —————————————————— |id|Name |Age| —————————————————— |1|vasanthan|32| ——————————————————-
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| ——————————————————-
Below query will insert data into the mydoubts_table_users. insert into mydoubts_table_users(name,age)values(‘Seetha’,’33’);
‘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 »
A foreignkey in one table is used to connect with primarykey in another table
* 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.
* 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.