The Ultimate Beginners Guide to learn SQL Programming: A Smart Step by Step Guide to Learn SQL Database and Server. How to Building an Advanced and Elite Level in SQL by Base Leonard
Author:Base, Leonard [Base, Leonard]
Language: eng
Format: epub
Published: 2019-11-10T16:00:00+00:00
The "ORDER BY" clause can be utilized for specifying a list of columns to be sorted.
The "LIMIT" clause can be utilized for restricting the number of rows displayed upon execution of the command.
Note that only “SELECT” and “FROM” clauses are necessary to execute the command and all other clauses can be used on ad-hoc basis.
For instance, if you are interested in displaying only the "first name", "last name", and "job title" of all employees, you can utilize the syntax below:
"SELECT
lastname, firstname, jobtitle
FROM
employees;"
But if you would like to view all the columns in the “employees” table, use the syntax below:
"SELECT * FROM employees;"
In practice, it is recommended to list the columns you would like to view instead of using the asterisk (*) command, as the asterisk (*) will return all column data, some of which you may not be allowed to use. It will create “non-essential I/O disk and network traffic between the MySQL database server and the application”. If the columns are defined explicitly, then the "result set" becomes simpler to predict and handle. Suppose you are using the asterisk (*) and some other user modified the table and generated additional columns, you would receive a "result set" containing different columns than needed. Moreover, the use of asterisk (*) can potentially reveal sensitive data to unauthorized users.
MySQL SELECT DISTINCT
You can receive duplicate rows when searching for information from a table. You could utilizee the "DISTINCT" clause in the "SELECT" query to get rid of these redundant rows.
The "DISTINCT" clause syntax is given below:
"SELECT DISTINCT
columns
FROM
table_name
WHERE
where_conditions;"
EXAMPLE
The syntax below presents an example for the "DISTINCT" clause, used to selectively view “unique last names” of the employees from the "employees" table.
First, you need to display the “last names” of all employees from the “employees” tables using the syntax below:
"SELECT
last name
FROM
employees
ORDER BY last name;"
Now to get rid of the repeated last names, use the syntax below:
"SELECT DISTINCT
last name
FROM
employees
ORDER BY last name;"
Please note, if a column has been indicated to hold “NULL” values and the “DISTINCT” clause is used. Only one “NULL” value will be retained by the sever since the “DISTINCT” clause will consider all “NULL” values as identical.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Access | Data Mining |
Data Modeling & Design | Data Processing |
Data Warehousing | MySQL |
Oracle | Other Databases |
Relational Databases | SQL |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8281)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6649)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6618)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6496)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6278)
Driving Data Quality with Data Contracts by Andrew Jones(6236)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(5998)
Learning SQL by Alan Beaulieu(5981)
Weapons of Math Destruction by Cathy O'Neil(5773)
Big Data Analysis with Python by Ivan Marin(5311)
Data Engineering with dbt by Roberto Zagni(4318)
Solidity Programming Essentials by Ritesh Modi(3966)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3817)
Pandas Cookbook by Theodore Petrou(3528)
Blockchain Basics by Daniel Drescher(3292)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2899)
Feature Store for Machine Learning by Jayanth Kumar M J(2807)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2790)
Mastering Python for Finance by Unknown(2741)
