Cheap Jerseys Cheap NFL Jerseys Cheap NFL Jerseys Cheap Football jerseys Cheap NFL Jerseys Wholesale Jerseys Cheap NHL Jerseys Cheap Jerseys From China Cheap MLB Jerseys Cheap Jerseys Cheap Jerseys Cheap Jerseys Wholesale Jerseys SQL Select Statement - WTMatter

SQL Select Statement

SQL Select Statement

This is a detailed tutorial for the SQL Select Statement. Learn how you can fetch data or retrieve records from the database tables using the select query.

Use of SQL Select

Select Statement in SQL is used to select the records from the database tables. In other words, to fetch data from the database, we make use of the select statement. The SQL Select command returns result-set which is basically the data of tables in tabular form. A Statement in SQL is also called a Query, so SQL Select Statement is having the same meaning as SQL select query.

Now, this statement gives us the flexibility of selecting either the whole table or only a few columns. Moreover, we can use multiple different logics and other SQL statements like the WHERE statement to fetch only those table rows that satisfy a condition.

SQL Select Statement Syntax

The basic syntax for the SQL Select is written below.

Here col_1 and col_2 represent two different columns of a database table file the table_name is the actual name of the table defined in the database itself. You can one or more table columns using this statement. Make sure the column names are separated with commas.

In case you want to select or fetch all the columns of the table then you can use the * symbol instead of writing the comma-separated names for all columns. The syntax for the same is defined below.

Further, the other SQL Statements like WHERE condition syntax can be added along with syntax which we’ll discuss later in the WHERE statement article separately. Here we’re just discussing the basic Syntax of SQL select statement.

SQL Select Example

We have a demo database. Now we’ll first select some particular columns and then all of the columns from a particular table using the SQL Select statement. The database name is school and the table name from which we’re going to select records is named as employees. We’re using MySQL Database with phpMyAdmin as the GUI for running queries and result showcase.

Selecting Particular Columns

We’ll select the first_name, last_name and the email columns of the table employees using the SQL select. The query is defined below and afterward, the screenshot for the out is given.



SQL Select Example Selecting Particular Columns

Selecting All Columns

As defined in the syntax selection, to fetch all of the columns, instead of writing the names of each column, we’ll simply use the * symbol. The query to fetch all the columns and rows for the table employees is written below.



SQL Select All Query Example

So, that’s all about SQL Select statement. It is often used along with other SQL statements like the WHERE statement which you may find out in one of the other articles.

I hope you find this guide useful. If so, do share it with others who are willing to learn SQL. If you have any questions related to this article, feel free to ask them in the comments section.

Helpful Associated Guide.

Also, don’t forget to Subscribe to WTMatter!

Subscribe To WTMatter!

Receive updates of our latest articles via email. Enter your email address below to get started.

Leave a Reply

Your email address will not be published. Required fields are marked *