SELECT

SELECT from SQl command

SQL query language is used to retrieve the information stored in the database.In SQL a query has the following (simplified) form.brackets [ ] are optional):

Syntax:-

select [distinct] <column(s)>
from <table>
[ where <condition> ]
[ order by <column(s) [asc|desc]> ]

 

EXAMPLES:-

SQL>select * from USERS;

SQL>select name,email,phone from USERS;

 

 

SELECT sql command

SELECt command Retrieves data from one or more tables. When you use SQL SELECT to create a query, Visual FoxPro parses the query and retrieves the specified data from the tables. You can create a SQL SELECT query from the Command window, in a Visual FoxPro program, or using the Query Designer. You must read the Considerations for SQL SELECT Statements help topic for more information on using SQL SELECT.

SYNTAX:-

 

SELECT duplicate records from table

You can use SELECT command for performaing single as well as complax operations depending on requirements.Belo is a simple use of SQL statement for getting duplicate records from database table:-

SELECT *
FROM `<table>`
WHERE  <key>
IN (

SELECT <key>
FROM  <table>
GROUP BY <key>
HAVING count( * ) >1
)
 

Example:-

SELECT *
FROM `demo`
WHERE id
IN (

SELECT id
FROM demo
GROUP BY id
HAVING count( * ) >1
)

 

 

Syndicate content