SQL query Statements

Source: Internet
Author: User
Tags logical operators

1.

SELECT * FROM table name

Select DISTINCT query list from table name//Redo Query

2. Conditional query

Select query list from table name where filter criteria;

SELECT * FROM Employees where salary>12000;

Select Last_Name, department_id from Emplyees where department_id!=90;

Select last_name,salary,commission_pct from Emplyees where salary>=10000 and salary<=20000;

SELECT * FROM employees where last_name like '%a% ';

SELECT * FROM employees where last_name like ' ___e_a% ';

SELECT * FROM employees where last_name like ' _\_% '; The 2nd character is _, which requires the function escape character \.

SELECT * FROM employees where last_name like ' _$_% ' escape ' $ ';

Filter by conditional expression:

Conditional operator:> < =! = <> >= <=

Filter by logical expression:

Function: Used to join conditional expressions

&& and: Two conditions are true, the result is true, and vice versa is False

|| And OR:

Logical operators: && | |    ! And Or not

Fuzzy query:

Like (with wildcard character with% 0 or any number of characters, _ any single character) between and in are NULL is NOT NULL

SQL query Statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.