Question

What Is An Inline Query In SQL?

By manchun.pandit ·
An inline query is something when we paste the query instead of the table name. One of the most common uses of an inline query in the SQL is for; simplifying the complex queries into a simple query through the removal of join operations and those conditions that hinder the conversion of complex query into a simple query.

SQL Subquery/ Inline query are;

1). SQL query within a query that can return the list of records or individual values.
2). They are like nested queries that help through providing the data to the enclosing query.
3). Make sure that the subqueries are enclosed with the parenthesis.

Take a look at this example;

select c1, c2 from tab1;
select c1, c2 from (select c1,c2 from tab1)- in this query, inline query from tab1 is used.

In both cases, the output will be the same.

The use of inline query in SQL;

a). To get the limited columns.
b). For best output from a complex query.
c). For perfect end to end analysis.

Look at one more example mentioned below;

In the following FROM clause, the table is symbolized by the sub-query.

SELECT * FROM (SELECT id, name FROM users) : https://www.janbasktraining.com/blog/create-table-in-sql-server/

Now, this sub-query is known as the inline view. In this case, we are not selecting the rows from the table directly, but we are selecting through an “inline view”. Subqueries can be easily utilized in various forms, even at different locations inside any query. There is nothing like a general syntax. The SQL sub-queries are just like other regular queries that are placed inside the parenthesis.
1 total post (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

Inlline querry

by palakbisht011 In reply to What Is An Inline Query I ...

Inline querry is also known as subquerry or nested querry, it is querry within another Sql querry and embbeded with in WHERE clause. Inline querries can be used Select, Insert, Update and Delete along with operators like =, <, >, >=,<=, etc.

Back to Tips and Tricks Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums