Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:38:39+00:00 2026-06-12T11:38:39+00:00

is there an SQL command to delete the first X lines of a database

  • 0

is there an SQL command to delete the first X lines of a database table?

I have a database table containing some information but no id or auto-incrementing value and a program that processes the first X lines of this table.
Afterwards these X lines need to be deleted. So the standard query is:

DELETE FROM table WHERE something = value;

So, is there a way to build a query like:

DELETE FROM table WHERE rownumber <= X;

I have tried this command, but nothing happens to the database..
Do you have any clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:38:40+00:00Added an answer on June 12, 2026 at 11:38 am

    Use LIMIT on your delete:

    DELETE FROM table WHERE condition LIMIT 10
    

    Or, if you don’t want the condition

    DELETE FROM table LIMIT 10
    

    Remember that the order in which rows will be deleted is undefined – it depends on your DBMS configuration and table indices. You should include an ORDER BY so that the deletion is done in a defined order, e.g. ORDER BY id ASC to delete the lowest IDs first.

    See the MySQL documentation for DELETE for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a SQL command that will list all the tables in a database
I have to delete some rows in the database. I'm using Entity Framework 4.3
I have a series of T-SQL DELETE FROM TABLE and INSERT statements to run.
Current situation: Delete command executed on production database SQL Server Rows are not available
Is there a straight forward way to view the SQL command text actually executed
Is there a command I can run inside my SQL script so that it
In SQL Developer, there is no command to create a connection based on an
Is there anyway to carry out an SQL transaction in one command? eg mysql_query(
I have a table that stores trees. There is a node_id and parent_id. When
I have an SQL Server 2005 database, and I tried putting indexes on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.