SQL Examples - W3Schools

SQL Examples ❮ Previous Next ❯

SQL Syntax

Select all the records from a specific table ("Customers")

Example Explained

SQL SELECT

SELECT Column SELECT *

Examples Explained

SQL SELECT DISTINCT

SELECT DISTINCT

Examples Explained

SQL WHERE

WHERE Clause Text Fields vs. Numeric Fields

Examples Explained

SQL AND, OR and NOT Operators

AND OR NOT Combining AND, OR and NOT

Examples Explained

SQL ORDER BY

ORDER BY ORDER BY DESC ORDER BY Several Columns

Examples Explained

SQL NULL Values

IS NULL Operator IS NOT NULL Operator

Examples Explained

w3schools CERTIFIED . 2022

Get Certified!

Take the SQL exam and become w3schools certified!! $95 ENROLL

SQL SELECT TOP

SELECT TOP LIMIT SELECT TOP PERCENT SELECT TOP and add a WHERE Clause

Examples Explained

SQL MIN() and MAX()

MIN() MAX()

Examples Explained

SQL COUNT, AVG() and SUM()

COUNT() AVG() SUM()

Examples Explained

SQL LIKE

LIKE - select all table rows starting with "a" LIKE - select all table rows ending with "a" LIKE - select all table rows that have "or" in any position LIKE - select all table rows that have "r" in the second position LIKE - select all table rows that starts with "a" and ends with "o" LIKE - select all table rows that does NOT start with "a"

Examples Explained

SQL Wildcards

Using the % Wildcard Using the _ Wildcard Using the [charlist] Wildcard Using the [!charlist] Wildcard

Examples Explained

SQL IN

IN NOT IN

Examples Explained

SQL BETWEEN

BETWEEN NOT BETWEEN BETWEEN with IN BETWEEN Text Values NOT BETWEEN Text Values

Examples Explained

SQL Aliases

Alias for Columns Two Aliases Alias for Tables

Examples Explained

SQL Joins

INNER JOIN LEFT JOIN RIGHT JOIN Self JOIN

Examples Explained

SQL UNION

UNION UNION ALL UNION With WHERE UNION ALL With WHERE

Examples Explained

SQL GROUP BY

GROUP BY GROUP BY and ORDER BY GROUP BY With JOIN

Examples Explained

SQL HAVING

HAVING and GROUP BY HAVING and ORDER BY

Examples Explained

SQL EXISTS

EXISTS

Example Explained

SQL ANY and ALL

ANY ALL

Examples Explained

SQL CASE

CASE 1 CASE 2

Examples Explained

SQL Comments

Single Line Comments Single Line Comments At The End Of a Line Multi-line Comments

Examples Explained

SQL Database

SQL Database tutorials can be found here:

SQL Create DB SQL Drop DB SQL Backup DB SQL Create Table SQL Drop Table SQL Alter Table SQL Constraints SQL Not Null SQL Unique SQL Primary Key SQL Foreign Key SQL Check SQL Default SQL Index SQL Auto Increment SQL Dates SQL Views SQL Injection SQL Hosting

Kickstart your career

Get certified by completing the course

Get certified w3schools CERTIFIED . 2024 ❮ Previous Next ❯ +1 Track your progress - it's free! Log in Sign Up

Từ khóa » Câu Lệnh Limit Trong Sql Server