简体   繁体   中英

SQL Select all rows greater than a value

I have a set of rows in a table that each have a unique key that auto-increments every time a new event is created. For example, the first row that has been created has a key of "1", the second row that has been created has a key of "2", and so on.

I would like to select all of the rows in the table that have a key that is greater than a particular value. For example, if I specify the value to be "6", I want to retrieve all of the rows in the table that have a value greater than 6 in their unique key column.

What is the SQL statement for this operation?

The query would be:

SELECT * FROM Table WHERE UniqueKey > 6

Replace Table with the name of your table, UniqueKey with the field you wish to check for and 6 with whatever value you wish to check for.

I would suggest visiting the w3schools website and looking at the SELECT and WHERE clause pages.

http://www.w3schools.com/sql/sql_select.asp

http://www.w3schools.com/sql/sql_where.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM