GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

MySQL Order By and Distinct Clause

Gk Scientist November 14, 2022 No Comments
Tweet WhatsApp Telegram

Table of Contents

  • MySQL Order By:
  • Syntax of MySQL Order By Clause:
  • Example of MySQL Order By Clause for Ascending Order (ASC):
  • Example of MySQL Order By Clause for Descending Order (DESC):
  • MySQL Distinct:
  • Syntax of MySQL Distinct:
  • Example of MySQL Distinct Clause:
  • Example of MySQL Order By and Distinct Clause:

MySQL Order By:

When you use the SELECT statement to query data from a table, the result set is not sorted in any 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.

Syntax of MySQL Order By Clause:

SELECT * FROM table_name ORDER BY
col1 ASC | DESC

Example of MySQL Order By Clause for Ascending Order (ASC):

Example of MySQL Order By Statement for Ascending Order - MySQL Order By and Distinct Clause

Example of MySQL Order By Clause for Descending Order (DESC):

Example of MySQL Order By Statement for Descending Order - MySQL Order By and Distinct Clause

MySQL Distinct:

When querying data from a table, you may get duplicate rows. In order to remove these duplicate rows, you use the DISTINCT clause in the SELECT statement.

Syntax of MySQL Distinct:

SELECT DISTINCT column_name FROM table-name

Example of MySQL Distinct Clause:

Example of MySQL Distinct Clause - MySQL Order By and Distinct Clause

Example of MySQL Order By and Distinct Clause:

Example of MySQL Order By and Distinct Clause - MySQL Order By and Distinct Clause

Secondary Storage Devices
Computer Memory
Cloud Computing
Information Security in E-Commerce
Structured Programming
Wireless Networking
MySQL– Wikipedia
Prev Article
Next Article

Related Articles

Python MySQL Delete Query
Python MySQL Delete Query: (1) Delete query deletes data and …
Gk Scientist December 13, 2022 Computer

Python MySQL Delete Query

Java Encapsulation
Java Encapsulation: We can use the Eclipse IDE for this …
Gk Scientist January 9, 2023 Computer

Java Encapsulation

Types of Variables in Java
Types of Variables in Java: We can use the Eclipse …
Gk Scientist January 7, 2023 Computer

Types of Variables in Java

Python Data Types
Python Data Types: We can use the PyCharm code editor …
Gk Scientist November 23, 2022 Computer

Python Data Types

Python GUI Calculator Project
Python GUI Calculator Project: We can use the PyCharm code …
Gk Scientist December 25, 2022 Computer

Python GUI Calculator Project

Rock Paper Scissors Game in Python (Using Random Module)
Rock Paper Scissors Game in Python: We can use the …
Gk Scientist December 3, 2022 Computer

Rock Paper Scissors Game in Python (Using Random Module)

Java String Methods
Java String Methods: We can use the Eclipse IDE for this …
Gk Scientist January 3, 2023 Computer

Java String Methods

Database Models or Data Models
Data Models: The database model, commonly known as the data …
Gk Scientist October 16, 2022 Computer

Database Models or Data Models

Leave a Reply Cancel Reply

Search

  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (215) Current Affairs (4) Current Content (0) Economy (17) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...