SlideShare a Scribd company logo
8/10/13 SQL SELECT Statement
beginner-sql-tutorial.com/sql-select-statement.htm 1/3
SQL SELECT Statement
The most commonly used SQL command is SELECT statement. The SQL SELECT statement is used to query or
retrieve data from a table in the database. A query may retrieve information from specified columns or from all
of the columns in the table. To create a simple SQL SELECT Statement, you must specify the column(s) name
and the table name. The whole query is called SQL SELECT Statement.
Syntax of SQL SELECT Statement:
SELECT column_list FROM table-name
[WHERE Clause]
[GROUP BY clause]
[HAVING clause]
[ORDER BY clause];
table-name is the name of the table from which the information is retrieved.
column_list includes one or more columns from which data is retrieved.
The code within the brackets is optional.
database table student_details;
id first_namelast_nameagesubject games
100Rahul Sharma 10 Science Cricket
101Anjali Bhagwat 12 Maths Football
102Stephen Fleming 09 Science Cricket
103Shekar Gowda 18 Maths Badminton
104Priya Chandra 15 Economics Chess
NOTE: These database tables are used here for better explanation of SQL commands. In reality, the tables can
have different columns and different data.
For example, consider the table student_details. To select the first name of all the students the query would be
like:
8/10/13 SQL SELECT Statement
beginner-sql-tutorial.com/sql-select-statement.htm 2/3
SELECT first_name FROM student_details;
NOTE: The commands are not case sensitive. The above SELECT statement can also be written as "select
first_name from students_details;"
You can also retrieve data from more than one column. For example, to select first name and last name of all
the students.
SELECT first_name, last_name FROM student_details;
You can also use clauses like WHERE, GROUP BY, HAVING, ORDER BY with SELECT statement. We will discuss
these commands in coming chapters.
NOTE: In a SQL SELECT statement only SELECT and FROM statements are mandatory. Other clauses like
WHERE, ORDER BY, GROUP BY, HAVING are optional.
How to use expressions in SQL SELECT Statement?
Expressions combine many arithmetic operators, they can be used in SELECT, WHERE and ORDER BY Clauses of
the SQL SELECT Statement.
Here we will explain how to use expressions in the SQL SELECT Statement. About using expressions in WHERE
and ORDER BY clause, they will be explained in their respective sections.
The operators are evaluated in a specific order of precedence, when more than one arithmetic operator is used
in an expression. The order of evaluation is: parentheses, division, multiplication, addition, and subtraction. The
evaluation is performed from the left to the right of the expression.
For example: If we want to display the first and last name of an employee combined together, the SQL Select
Statement would be like
SELECT first_name + ' ' + last_name FROM employee;
Output:
first_name + ' ' + last_name
---------------------------------
Rahul Sharma
Anjali Bhagwat
Stephen Fleming
Shekar Gowda
Priya Chandra
You can also provide aliases as below.
SELECT first_name + ' ' + last_name AS emp_name FROM employee;
Output:
emp_name
8/10/13 SQL SELECT Statement
beginner-sql-tutorial.com/sql-select-statement.htm 3/3
-------------
Rahul Sharma
Anjali Bhagwat
Stephen Fleming
Shekar Gowda
Priya Chandra

More Related Content

What's hot

Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
DeepakDeedarSingla
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
Abdelhay Shafi
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
Jas Singh Bhasin
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In SqlAnurag
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
Swapnali Pawar
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
 
View
ViewView
SQL : Structured Query Language
SQL : Structured Query LanguageSQL : Structured Query Language
SQL : Structured Query Language
Abhishek Gautam
 

What's hot (13)

Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 
Sql reference from w3 schools
Sql reference from w3 schools Sql reference from w3 schools
Sql reference from w3 schools
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
 
Sql basics
Sql  basicsSql  basics
Sql basics
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
 
Sql commands
Sql commandsSql commands
Sql commands
 
View
ViewView
View
 
SQL : Structured Query Language
SQL : Structured Query LanguageSQL : Structured Query Language
SQL : Structured Query Language
 

Viewers also liked

Adorning the world_art_of_the_marquesas_islands
Adorning the world_art_of_the_marquesas_islandsAdorning the world_art_of_the_marquesas_islands
Adorning the world_art_of_the_marquesas_islandsWILSON CUNHA ANDRADE
 
Web based intro and tutorial
Web based intro and tutorialWeb based intro and tutorial
Web based intro and tutorialThomas Sprow III
 
Journal of Biomolecular Research & Therapeutics
Journal of Biomolecular Research & TherapeuticsJournal of Biomolecular Research & Therapeutics
Journal of Biomolecular Research & Therapeutics
OMICS International
 
Creating my front cover
Creating my front coverCreating my front cover
Creating my front covertomgoodyear
 
Commentary of edited photographs
Commentary of edited photographsCommentary of edited photographs
Commentary of edited photographsBigrossgetcrunk
 
Matemáticas 1 Primer Parcial Leyes de los Exponentes
Matemáticas 1 Primer Parcial Leyes de los ExponentesMatemáticas 1 Primer Parcial Leyes de los Exponentes
Matemáticas 1 Primer Parcial Leyes de los Exponentesinsucoppt
 
Journals
JournalsJournals
Matemáticas 1 Primer Parcial Productos Notables
Matemáticas 1 Primer Parcial Productos NotablesMatemáticas 1 Primer Parcial Productos Notables
Matemáticas 1 Primer Parcial Productos Notablesinsucoppt
 
Conference on Diabetes and Metabolism
Conference on Diabetes and MetabolismConference on Diabetes and Metabolism
Conference on Diabetes and Metabolism
OMICS International
 
Conference on Radiology
Conference on RadiologyConference on Radiology
Conference on Radiology
OMICS International
 
2013-11-22-HappyCo-1.00
2013-11-22-HappyCo-1.002013-11-22-HappyCo-1.00
2013-11-22-HappyCo-1.00Petr Ludwig
 
Creating my contents page
Creating my contents pageCreating my contents page
Creating my contents pagetomgoodyear
 
Journal of Women's Health Care
Journal of Women's Health Care Journal of Women's Health Care
Journal of Women's Health Care
OMICS International
 

Viewers also liked (16)

Adorning the world_art_of_the_marquesas_islands
Adorning the world_art_of_the_marquesas_islandsAdorning the world_art_of_the_marquesas_islands
Adorning the world_art_of_the_marquesas_islands
 
Web based intro and tutorial
Web based intro and tutorialWeb based intro and tutorial
Web based intro and tutorial
 
Journal of Biomolecular Research & Therapeutics
Journal of Biomolecular Research & TherapeuticsJournal of Biomolecular Research & Therapeutics
Journal of Biomolecular Research & Therapeutics
 
Creating my front cover
Creating my front coverCreating my front cover
Creating my front cover
 
Commentary of edited photographs
Commentary of edited photographsCommentary of edited photographs
Commentary of edited photographs
 
Matemáticas 1 Primer Parcial Leyes de los Exponentes
Matemáticas 1 Primer Parcial Leyes de los ExponentesMatemáticas 1 Primer Parcial Leyes de los Exponentes
Matemáticas 1 Primer Parcial Leyes de los Exponentes
 
Proteinas
ProteinasProteinas
Proteinas
 
Journals
JournalsJournals
Journals
 
Matemáticas 1 Primer Parcial Productos Notables
Matemáticas 1 Primer Parcial Productos NotablesMatemáticas 1 Primer Parcial Productos Notables
Matemáticas 1 Primer Parcial Productos Notables
 
Technology
TechnologyTechnology
Technology
 
Conference on Diabetes and Metabolism
Conference on Diabetes and MetabolismConference on Diabetes and Metabolism
Conference on Diabetes and Metabolism
 
Legal and ethical
Legal and ethicalLegal and ethical
Legal and ethical
 
Conference on Radiology
Conference on RadiologyConference on Radiology
Conference on Radiology
 
2013-11-22-HappyCo-1.00
2013-11-22-HappyCo-1.002013-11-22-HappyCo-1.00
2013-11-22-HappyCo-1.00
 
Creating my contents page
Creating my contents pageCreating my contents page
Creating my contents page
 
Journal of Women's Health Care
Journal of Women's Health Care Journal of Women's Health Care
Journal of Women's Health Care
 

Similar to Sql select statement

Sql where clause
Sql where clauseSql where clause
Sql where clauseVivek Singh
 
SQL Query
SQL QuerySQL Query
SQL Query
Imam340267
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
Balqees Al.Mubarak
 
Sql2
Sql2Sql2
Oracle Notes
Oracle NotesOracle Notes
Oracle Notes
Abhishek Sharma
 
Its about a sql topic for basic structured query language
Its about a sql topic for basic structured query languageIts about a sql topic for basic structured query language
Its about a sql topic for basic structured query language
IMsKanchanaI
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statementsArun Nair
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
MS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A DatabaseMS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A Database
sqlserver content
 
Retrieving Data From A Database
Retrieving Data From A DatabaseRetrieving Data From A Database
Retrieving Data From A Database
DataminingTools Inc
 
MS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A DatabaseMS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A Database
sqlserver content
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
SUSHANTPHALKE2
 
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQueryPPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
Abhishek590097
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
EllenGracePorras
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
Brian Foote
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
amitabros
 

Similar to Sql select statement (20)

Sql where clause
Sql where clauseSql where clause
Sql where clause
 
SQL Query
SQL QuerySQL Query
SQL Query
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
 
Sql2
Sql2Sql2
Sql2
 
Oracle Notes
Oracle NotesOracle Notes
Oracle Notes
 
Its about a sql topic for basic structured query language
Its about a sql topic for basic structured query languageIts about a sql topic for basic structured query language
Its about a sql topic for basic structured query language
 
Query
QueryQuery
Query
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
 
Sql commands
Sql commandsSql commands
Sql commands
 
MS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A DatabaseMS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A Database
 
Retrieving Data From A Database
Retrieving Data From A DatabaseRetrieving Data From A Database
Retrieving Data From A Database
 
MS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A DatabaseMS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A Database
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
 
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQueryPPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Sql
SqlSql
Sql
 

More from Vivek Singh

C programming session 14
C programming session 14C programming session 14
C programming session 14Vivek Singh
 
C programming session 13
C programming session 13C programming session 13
C programming session 13Vivek Singh
 
C programming session 11
C programming session 11C programming session 11
C programming session 11Vivek Singh
 
C programming session 10
C programming session 10C programming session 10
C programming session 10Vivek Singh
 
C programming session 08
C programming session 08C programming session 08
C programming session 08Vivek Singh
 
C programming session 07
C programming session 07C programming session 07
C programming session 07Vivek Singh
 
C programming session 05
C programming session 05C programming session 05
C programming session 05Vivek Singh
 
C programming session 04
C programming session 04C programming session 04
C programming session 04Vivek Singh
 
C programming session 02
C programming session 02C programming session 02
C programming session 02Vivek Singh
 
C programming session 01
C programming session 01C programming session 01
C programming session 01Vivek Singh
 
C programming session 16
C programming session 16C programming session 16
C programming session 16Vivek Singh
 
Niit aptitude question paper
Niit aptitude question paperNiit aptitude question paper
Niit aptitude question paperVivek Singh
 
Excel shortcut and tips
Excel shortcut and tipsExcel shortcut and tips
Excel shortcut and tipsVivek Singh
 
Sql update statement
Sql update statementSql update statement
Sql update statementVivek Singh
 
Sql tutorial, tutorials sql
Sql tutorial, tutorials sqlSql tutorial, tutorials sql
Sql tutorial, tutorials sqlVivek Singh
 
Sql query tuning or query optimization
Sql query tuning or query optimizationSql query tuning or query optimization
Sql query tuning or query optimizationVivek Singh
 
Sql query tips or query optimization
Sql query tips or query optimizationSql query tips or query optimization
Sql query tips or query optimizationVivek Singh
 
Sql order by clause
Sql order by clauseSql order by clause
Sql order by clauseVivek Singh
 

More from Vivek Singh (20)

C programming session 14
C programming session 14C programming session 14
C programming session 14
 
C programming session 13
C programming session 13C programming session 13
C programming session 13
 
C programming session 11
C programming session 11C programming session 11
C programming session 11
 
C programming session 10
C programming session 10C programming session 10
C programming session 10
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
C programming session 07
C programming session 07C programming session 07
C programming session 07
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
C programming session 16
C programming session 16C programming session 16
C programming session 16
 
Niit aptitude question paper
Niit aptitude question paperNiit aptitude question paper
Niit aptitude question paper
 
Excel shortcut and tips
Excel shortcut and tipsExcel shortcut and tips
Excel shortcut and tips
 
Sql update statement
Sql update statementSql update statement
Sql update statement
 
Sql tutorial, tutorials sql
Sql tutorial, tutorials sqlSql tutorial, tutorials sql
Sql tutorial, tutorials sql
 
Sql subquery
Sql subquerySql subquery
Sql subquery
 
Sql rename
Sql renameSql rename
Sql rename
 
Sql query tuning or query optimization
Sql query tuning or query optimizationSql query tuning or query optimization
Sql query tuning or query optimization
 
Sql query tips or query optimization
Sql query tips or query optimizationSql query tips or query optimization
Sql query tips or query optimization
 
Sql order by clause
Sql order by clauseSql order by clause
Sql order by clause
 

Recently uploaded

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

Sql select statement

  • 1. 8/10/13 SQL SELECT Statement beginner-sql-tutorial.com/sql-select-statement.htm 1/3 SQL SELECT Statement The most commonly used SQL command is SELECT statement. The SQL SELECT statement is used to query or retrieve data from a table in the database. A query may retrieve information from specified columns or from all of the columns in the table. To create a simple SQL SELECT Statement, you must specify the column(s) name and the table name. The whole query is called SQL SELECT Statement. Syntax of SQL SELECT Statement: SELECT column_list FROM table-name [WHERE Clause] [GROUP BY clause] [HAVING clause] [ORDER BY clause]; table-name is the name of the table from which the information is retrieved. column_list includes one or more columns from which data is retrieved. The code within the brackets is optional. database table student_details; id first_namelast_nameagesubject games 100Rahul Sharma 10 Science Cricket 101Anjali Bhagwat 12 Maths Football 102Stephen Fleming 09 Science Cricket 103Shekar Gowda 18 Maths Badminton 104Priya Chandra 15 Economics Chess NOTE: These database tables are used here for better explanation of SQL commands. In reality, the tables can have different columns and different data. For example, consider the table student_details. To select the first name of all the students the query would be like:
  • 2. 8/10/13 SQL SELECT Statement beginner-sql-tutorial.com/sql-select-statement.htm 2/3 SELECT first_name FROM student_details; NOTE: The commands are not case sensitive. The above SELECT statement can also be written as "select first_name from students_details;" You can also retrieve data from more than one column. For example, to select first name and last name of all the students. SELECT first_name, last_name FROM student_details; You can also use clauses like WHERE, GROUP BY, HAVING, ORDER BY with SELECT statement. We will discuss these commands in coming chapters. NOTE: In a SQL SELECT statement only SELECT and FROM statements are mandatory. Other clauses like WHERE, ORDER BY, GROUP BY, HAVING are optional. How to use expressions in SQL SELECT Statement? Expressions combine many arithmetic operators, they can be used in SELECT, WHERE and ORDER BY Clauses of the SQL SELECT Statement. Here we will explain how to use expressions in the SQL SELECT Statement. About using expressions in WHERE and ORDER BY clause, they will be explained in their respective sections. The operators are evaluated in a specific order of precedence, when more than one arithmetic operator is used in an expression. The order of evaluation is: parentheses, division, multiplication, addition, and subtraction. The evaluation is performed from the left to the right of the expression. For example: If we want to display the first and last name of an employee combined together, the SQL Select Statement would be like SELECT first_name + ' ' + last_name FROM employee; Output: first_name + ' ' + last_name --------------------------------- Rahul Sharma Anjali Bhagwat Stephen Fleming Shekar Gowda Priya Chandra You can also provide aliases as below. SELECT first_name + ' ' + last_name AS emp_name FROM employee; Output: emp_name
  • 3. 8/10/13 SQL SELECT Statement beginner-sql-tutorial.com/sql-select-statement.htm 3/3 ------------- Rahul Sharma Anjali Bhagwat Stephen Fleming Shekar Gowda Priya Chandra