
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we use MySQL SELECT without FROM clause?
FROM clause after SELECT shows the references to a table. But if there is no reference to any table then we can use SELECT without the FROM clause. In other words, we can say that SELECT can be used to retrieve rows computed without reference to any table. Consider the following statements −
mysql> Select concat_ws(" ","Hello", "World"); +---------------------------------+ | concat_ws(" ","Hello", "World") | +---------------------------------+ | Hello World | +---------------------------------+ 1 row in set (0.00 sec) mysql> Set @var1=100; Query OK, 0 rows affected (0.00 sec) mysql> Select @var1; +-------+ | @var1 | +-------+ | 100 | +-------+ 1 row in set (0.00 sec)
- Related Articles
- Can we select second largest record from a table without using LIMIT clause in MySQL?
- How can we use a MySQL subquery with FROM clause?
- How Can we use MySQL DISTINCT clause with WHERE and LIMIT clause?
- How can we use ASCII() function with MySQL WHERE clause?
- How can we use CHAR_LENGTH() function with MySQL WHERE clause?
- How can we use BIN() function with MySQL WHERE clause?
- How can we use FIND_IN_SET() function with MySQL WHERE clause?
- How can we use MySQL INSTR() function with WHERE clause?
- How can we use MySQL SUM() function with HAVING clause?
- How can we use two columns with MySQL WHERE clause?
- How can we use WHERE clause with MySQL INSERT INTO command?
- Can we use WHERE clause inside MySQL CASE statement?
- Why should we not use group functions with non-group fields without GROUP BY clause in MySQL SELECT query?
- Can we use MySQL GROUP BY clause with multiple columns like MySQL DISTINCT clause is used?
- Can we use a comma between MySQL SELECT statements?

Advertisements