To fetch data from the database we must need a select query. This is a simple SQL communication why. Using select query we can select data from the database from specific table.
Below select syntax query syntax and example given it will help you to get data from the database.
Syntax
Basic syntax for select query.
SELECT (column-names) FROM (table-name)
Include all columns.
SELECT * FROM (table-name)
Note: *is wildcards, Which means it will return all columns from table.
Users Table
USERS data-table Exmaple.
id | firstname | lastname | city | country | phone |
---|---|---|---|---|---|
1 | jon | mick | mesur | uk | +1983565965 |
1 | regu | mawd | landon | us | +15216545464 |
3 | ponty | rick | mumbai | in | +918356596525 |
4 | butt | jose | sydny | aus | +35785287584 |
Examples 1: Select Table
Select all record from table.
SELECT * FROM users
Example 2: Specific Column
By giving name specific column query will return from the user's table.
SELECT id, name, phone FROM users
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- How To Improve SQL Query Performance
- How To Change ENUM DataType Without Losing Data Laravel Migration
- Select Data From Database Table Query
- Create Database In MYSQL Using PHP Script Example
- SOLVED # 1118 Row size too large 8126. Changing some columns to TEXT or BLOB
- [FIXED] Unknown Collation: utf8mb4_0900_ai_ci In MYSQL
- Unique violation: 7 ERROR: duplicate key value violates unique constraint "users_pkey" DETAIL: Key (id)=(1) already exists.
- The Syntax of MySQL