Connect with us

SQL

SQL Top

mm

Published

on

The SQL TOP or LIMIT phrase is used to obtain TOP N number records from a table.

SQL Syntax:-
SELECT column_name FROM table_name LIMIT number;

Example:-

The subsequent SQL query selects 5 records from the “Visitors” table:
SELECT * FROM Visitors LIMIT 5;

Example2:-

The subsequent SQL query selects top 2 records from the “Visitors” table:
SELECT TOP 2 * FROM Visitors;

Example3:-

The subsequent SQL query selects the first 50% of the records from the “Visitors” table:
SELECT TOP 50 PERCENT * FROM Visitors;

Also Read :   SQL Drop Table

Hi, Thank you for reading my article. I am Victor, a professional blogger from Jaipur, India.I started webetutorial for blogging & sharing solution for developer questions, and now it’s empowering globally by helping them to make money.I am writing about starting & managing a blogs, WordPress, Magento, Social Media, SEO, Marketing, making money online, Investment, Finance, Gadgets, Fitness and more.

Continue Reading
Advertisement
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

two × four =

SQL

SQL Alter Table

mm

Published

on

The SQL ALTER TABLE is used to add, delete or modify columns in an existing table.
SQL Alter Table:-
ALTER TABLE table_name ADD column_name datatype

Drop Column:-

ALTER TABLE table_name DROP COLUMN column_name;

Add Unique Constraint:-

ALTER TABLE table_name ADD CONSTRAINT MyUniqueConstraint UNIQUE(column1, column2…);

Add Primary Key:-

ALTER TABLE table_name ADD CONSTRAINT PrimaryKey PRIMARY KEY (column1, column2…);

Also Read :   SQL Sorting Results
Continue Reading

Trending