Tuesday, 9 June 2020

how to select all the table to display

how to select all the table to display
select * from dummy.studentinfo;
how to display only required column
select firstname from dummy.studentinfo;
to get only firstname select firstname header only
select abcd from dummy.studentinfo;
at abcd -- insert what u want
get the data  with condition
SELECT * FROM dummy.studentinfo;
how to display the required column
SELECT * FROM dummy.studentinfo where name=1;
select the total table from that table display matched items
only required row
SELECT * FROM dummy.studentinfo where name<3;
it wil display all the table upto <3 of name
SELECT * FROM `studentinfo` WHERE 1
>1
it will display 2 only
<3
it will display 0 1 2
how to display required column where it is matched with certain items
SELECT firstname, lastname FROM dummy.studentinfo where name=1;
SELECT firstname, lastname FROM dummy.studentinfo where firstname= 'srikanth';
select two row headers firstname and last name. it is selected, but its have to display , matched items only display
how to display the items with conditon means if it is matched then only display
SELECT firstname, lastname FROM dummy.studentinfo where firstname= 'srikanth' and username ='un2';
it will display that matched items , display two row headers only
means ist it select that two rows, while display its match the conditon , that’s matched items in that row only display
SELECT firstname, lastname FROM dummy.studentinfo where firstname= 'srikanth' and username ='un2' and age<30;
to match any thing its display
one conditoon true, display
how to display the respective items if condition is matched
SELECT firstname, lastname FROM dummy.studentinfo where firstname= 'srikanth' and username ='un2' or age<30;
either two are true, that wil displays and age is less than 30 than one also displays
SELECT firstname, lastname FROM dummy.studentinfo where firstname= 'srikanth'  or age<30;
if any person age is less than 30, that items will be visible
how to display all columns respective data where conditon is matched
SELECT * FROM dummy.studentinfo where firstname= 'srikanth'  or age<30;

sorting in order
how to sort as per age, means incriemnt or decriment
orderby using this we can show in order

SELECT * FROM dummy.studentinfo where orderby age;
ascending order
sortin ascending order
SELECT * FROM dummy.studentinfo where orderby age desc;
select all rows in table or all columns and display the items in descending order
menas in age it has numbers , so display in some order
sort in descending order
how to display in alphabetical order
we have 4 rows, in that other than row header, we selected one row, we need that one be sort in alphateical, accordingly remain gwill display
SELECT * FROM dummy.studentinfo where orderby firstname;
reverse alphabetical order
SELECT * FROM dummy.studentinfo where orderby firstname desc;
sort the row in alphabetical order from z to a

No comments:

Post a Comment