MySQL ORDER BY(LAB3.6) - MySQL ORDER BY Summary in this...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
MySQL ORDER BY Summary : in this tutorial, you will learn how to sort a result set by using MySQL ORDER BY clause. Introduction to MySQL ORDER BY clause When you use the SELECT statement to query data from a table, the result set is not sorted in a specific order. To sort the result set, you use the ORDER BY clause. The ORDER BY clause allows you to: Sort a result set by a single column or multiple columns. Sort a result set by different columns in ascending or descending order. The following illustrates the syntax of the ORDER BY clause: 1 2 3 SELECT col1, col2,... FROM tbl ORDER BY col1 [ASC|DESC], col2 [ASC|DESC],... The ASC stands for ascending and the DESC stands for descending. By default, the ORDER BY clause sorts the result set in ascending order if you don’t specify ASC or DESC explicitly Let’s practice with some examples of using the ORDER BY clause. Use classicmodels database for the tasks below.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern