PyCodePro

Previously LP16 - A website that teaches Python programming language through interactive tutorials, practice exercises, and real-world projects.

Like / Group / Order By Command

Like / Group / Order by command



Like / Group / Order by command


Hey guys welcome to our new and last blog post of the year 2019 and this is very special blog because in this blog i will cover most of the topics of SQL .

In Previous Blog -

In previous Blog we learn about the select command and update command of SQL and quickly lets revise the select and update command of SQL so that we can start our blog as soon as earliest.

In Today's Blog

we will try to cover the most of the SQL commands without any delay lets start today's blog -

TO SELECT A PARTICULAR STUDENT

To display the particular record in the table we need to use the select command but in that select you need to give the value of primary key in the command which you give the value in the table so to display the particular record you need to enter the command as -
suppose there is a table named students and in the table the roll_no is primary key and the you need to see the record of Roll_no 10 so you need to enter the command as -

SELECT * FROM STUDENT WHERE ROLL_NO = 10 ;

Like Command

TO DISPLAY ALL RECORDS STARTING WITH ANY ALPHABET

to display all records starting with any alphabet then you need to use another command -
suppose there is a table named student and in that table you need to see the name of all student whose name starting with alphabet K then you Need to enter the commands as -

SELECT NAME FROM STUDENTS WHERE NAME LIKE ' DK % ' ;

In the command after the select we enter the name because we need to see the names of student from the table name students and K is the character so we use single quotes and then we need to see the name of student whose name starting with K so we write the % after the letter K .

TO DISPLAY THE RECORDS ENDING WITH ANY ALPHABETS

To display all records ending with any alphabet then you need to use another command -
suppose there is a table named student and in that table you need to see the name of all student whose name ending with alphabet K then you Need to enter the commands as -

SELECT NAME FROM STUDENTS WHERE NAME LIKE ' % DK ' ;

In the command after the select we enter the name because we need to see the names of student from the table name students and K is the character so we use single quotes and then we need to see the name of student whose name ending with K so we write the % before the letter K .

TO DISPLAY THE RECORDS WHERE THE ALPHABET COMING ANYWHERE EXCEPT STARTING AND END.

To display all records where the alphabet is coming anywhere except starting and ending then you need to use another command -
suppose there is a table named student and in that table you need to see the name of all student whose coming anywhere except starting and ending , alphabet K then you Need to enter the commands as -

SELECT NAME FROM STUDENTS WHERE NAME LIKE ' % DK % ' ;

In the command after the select we enter the name because we need to see the names of student from the table name students and K is the character so we use single quotes and then we need to see the name of student whose name neither starting with K or not ending with K so we write the % before and after the letter K .

Order By Command

Ascending order

this command is used to show the records in ascending order or descending order . suppose there is a table named student and in that table you need to see the records in ascending order then you need to enter the command as -
SELECT * FROM Child ORDER BY NAME ASC ;
In this command we give * after the select because we need to see all records and from the table named student and in the line order by name then we give the command to order the names in asc for ascending order .

Descending Order

This command is used to show the records in descending order . suppose there is a table named student and in that table you need to see the records in descending order then you need to enter the command as -

SELECT * FROM Child ORDER BY NAME DESC ;

In this command we give * after the select because we need to see all records and from the table named student and in the line order by name then we give the command to order the names in desc for descending order .

Group By Command

This command is use to display the frequency / occurrence / existing column of any particular entry

to display the frequency / occurrence / existing column of any particular entry

SELECT NAME COUNT * FROM Child GROUP BY NAME ;

That's all about today's topic . thank you for visiting



IN THE NEXT BLOG WE LEARN MORE ABOUT THE AGGREGATE FUNCTIONS IN THE SQL AND OTHER COMMANDS AND THE OTHER WORKING IN PYTHON AND OTHER IMPORTANT SUB TOPICS. THANK YOU FOR VISITING , KEEP LEARNING STAY TUNED FOR NEXT BLOG , FOLLOW OUR BLOG FOR REGULAR UPDATES , VIEW OUR PREVIOUS BLOG FOR THE BASIC CONCEPTS OF PYTHON AND OTHER BASIC CONCEPTS OF COMPUTER AND ALSO FOR THE IMPORTANT DEFINITIONS OF THE SQL , VISIT OUR SECOND BLOG – customercarereport.blogspot.com , VISIT OUR THIRD BLOG – top23things.blogspot.com , VISIT OUR YOU TUBE CHANNEL -  Learn Python Our YouTube channel will give you the short motivational speeches of the great person in the present there is only seven motivational videos on channel but in future I will upload the motivational videos soon .VISIT OUR INSTAGRAM PAGE – instagram.com/learnpython16, Our Instagram page is also a new page i just created few days ago but stay tuned I will upload the post very soon. Please support us by following our blog and by subscribing our YouTube channel and by following our Instagram page.

Like / Group / Order By Command Like / Group / Order By Command Reviewed by Learn Python on December 28, 2019 Rating: 5

No comments:

Powered by Blogger.