Connect with us

SQL

SQL Between

mm

Published

on

The BETWEEN operator is used to select values within a collection. The values could be numbers, text, or dates.
Syntax:-

SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2;
BETWEEN Example:-
The subsequent SQL statement selects all wears with a price BETWEEN 100 and 200:-

SELECT * FROM Wears WHERE Price BETWEEN 100 AND 200;
NOT BETWEEN Example:-
To display the wears outside the range of 100 and 200, apply NOT BETWEEN:-

SELECT * FROM Wear WHERE Price NOT BETWEEN 100 AND 200;
BETWEEN with IN Example:-
The subsequent SQL statement selects all wears with a price BETWEEN 100 and 200, but wears with a CategoryID of 10,20, or 30 must not be displayed:-

SELECT * FROM wears WHERE (Price BETWEEN 100 AND 200) AND NOT CategoryID IN (10, 20, 30);

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

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 Introduction
Continue Reading

Subscribe to our newsletter

Enter your email address to subscribe to blog and receive notifications of new articles by email.
100% Privacy. No spam guaranteed

Trending