Select Query in MySQL
SELECT statement use to select data from a database.
Syntex:-
1) If we have select few specific fields from table.
1 | Select coulmn_name1,coulmn_name2 from table_name; |
1 | select * from table_name; |
If we have a user table in database:
U_id | Uname | Mobile | City |
---|---|---|---|
1 | Raj | RAJPHONE | Ajmer |
2 | Ravi | RAVIPHONE | Jaipur |
3 | Vijay | VIJAYPHONE | Alwar |
1 | SELECT Uname,city FROM user; |
U_id | Uname | City |
---|---|---|
1 | Raj | Ajmer |
2 | Ravi | Jaipur |
3 | Vijay | Alwar |
1 | SELECT * FROM user ; |
U_id | Uname | Mobile | City |
---|---|---|---|
1 | Raj | RAJPHONE | Ajmer |
2 | Ravi | RAVIPHONE | Jaipur |
3 | Vijay | VIJAYPHONE | Alwar |
If we have to SELECT specific data from a user table Where city is Ajmer.
1 | SELECT Uname FROM user WHERE city= 'Ajmer' ; |
Uname |
---|
Raj |
No comments:
Post a Comment