answersLogoWhite

0


Best Answer

SELECT *

FROM ( SELECT FirstName LastName

FROM people

) @tempTable1

WHERE MOD(@temptable1.rn 2) 1

--even number query

SELECT *

FROM ( SELECT rownum rn firstname lastname

FROM people

) @temptable1

WHERE MOD(@temptable1.rn 3) 0

but it is not working properly...can anubody tell me what is rownum here...

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Sample Sql query with explanation for selecting the alternate row from the table?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between QBE and SQL?

Query by Example (QBE) is a database query language for relational databases. A QBE parser parses the search query and looks for the keywords. A more formal query string, in languages such as SQL, is then generated, which is finally executed. However, when compared with a formal query, the results in the QBE system will be more variable.SQL (Structured Query Language) SQL is a set-based, declarative query language, not an imperative language such as C or BASIC. However, there are extensions to Standard SQL which add procedural programming language functionality, such as control-of-flow constructs


What is the difference between Script and Query?

Script is a term used to describe programs that aren't compiled (that is, turned into 1's and 0's) first. A scripting engine reads the code exactly how you wrote it, and turns it into a computer program on the fly. Query is just a fancy word for question, but on the web it generally means "SQL Query." An SQL query is a way of asking a database for information, that follows the Structured Query Language syntax. All SQLs are a bit off of the actual SQL standard, and you have to work with whatever version your relational database (RD) supports.


What is the full form of SQL in computer?

Structured Query Language


What is Object Query Language OQL?

OQL is a database query language(related to ODMG) that is based on SQL and supports the adding, retrieving, querying, and invocation of objects. OQL is a version of the Structured Query Language. A object query language that supports complex data types such as multimedia, spatial, compound documents, etc., that are stored as objects. Standard SQL queries can still be used, and the OQL server process converts the objects into relational views. Sanjay


Difference in hibernate 2.0 and hibernate 3.0?

Enhanced Hibernate Query Language Enhanced Hibernate Criteria Query API Enhanced support for queries expressed in the native SQL dialect of the database

Related questions

What is ment by query?

Query is an instruction given to Database engine to retrieve the results. Example: Select EmployeeName From tblEmployees Where EmployeeID = 123; This is a sample query to retrieve the Name of a particular employee from the set of records saved already.


Selecting data by means of a query?

To select data using a query, you need to use a SELECT statement in SQL. Specify the columns you want to retrieve data from and the table where the data is located. You can also apply conditions using WHERE clause to filter the data before retrieving it.


What are some typical SQL interview questions?

Some sample SQL interview questions could be the following 1. Write an SQL query to display the current date. 2. Write a SQL query to name the employees who have worked here for 5 years.


Can write query within the query?

Yes, you can have a query inside a query. That is known as a sub-query.


What is the difference between an IXFR query and an AXFR query?

In earlier DNS implementations, any request for an update of zone data required a full transfer of the entire zone database using an AXFR query. With incremental transfer, an alternate query type (IXFR) can be used instead. This allows the secondary server to pull only those zone changes it needs to synchronize its copy of the zone with its source, either a primary or secondary copy of the zone maintained by another DNS server


What is post query and pre query?

pre query


A query that prompts for input whenever it is run is a run-time query?

A query that prompts for input whenever it is run is a Paremeter Query


What is Blaze the Cats love life if she has one?

She has none. She's restricted to being on her own in an alternate dimension and a childhood friendship with Silver, if you believe that she is from the future. This is very trivial for a console query, isn't it?


What is a nested query?

It is a query inside another query. Sometimes we might use one query to reduce down the amount of data to go through and then use another query based on the output of that query to get what you want. The first query is inside or nested in the first query.


What are subqueries used for in a database?

A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.A subquery is basically a query inside another query. Sometimes a main query needs to process data that is the result of another query. To extract that data a subquery could be built into a field in a main query. This is known as a subquery.


What does it mean to posses a question?

To possess a question means to have a query or inquiry about a certain topic or issue that one is seeking an answer or clarification for. It implies a curiosity or uncertainty that prompts the need for information or explanation.


Why do people use qbe?

QBE (or query-by-example) is often a quick method of creating simple SQL queries, especially by users who are not particularly SQL-savvy. Instead of having to remember specific SQL syntax, the user builds the query by selecting tables and fields from a display and entering WHERE and GROUP BY clause specifics in a fill-in-the-box manner.