×

注意!页面内容来自https://www.w3schools.com/sql/default.asp,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

<> #subtopnav { position:fixed; background-color: #282A35; color:#f1f1f1; padding:0; letter-spacing:1px; font-family: 'Source Sans Pro Topnav'sans-serif; font-size:0; top:56px; z-index:2; width:100%; white-space:nowrap; overflow:auto; scrollbar-width: none; max-width:1750px; margin:auto; left:0; right:0; } #subtopnav a{ display:inline-block; width:auto; margin:0!important; padding:5px 15px 5px 15px !important; font-size:15px!important; text-decoration: none; line-height: 1.5; } #subtopnav a:hover,#subtopnav a:focus,#subtopnav a:active{ background-color:#000000 !important; color:#ffffff !important; } #subtopnav a.active{ background-color: #ebedee!important;font-weight:bold; color:#000!important; } #btn_container_subtopnav { position:fixed; right:0; top:56px; font-size:0; xxborder-left:10px solid rgba(404253,0.5); } #btn_container_subtopnav a{ line-height:1.3!important; padding-top:7px!important; padding-bottom:6px!important; font-size:15px; background-color:#282A35; } #scroll_left_btn { cursor:pointer; display:none; position:fixed; left:0; top:56px; font-size: 15px; xborder-right: 10px solid rgba(404253,0.5); xbackground: red; } #scroll_left_btn span { xbackground-color:#282A35; background: linear-gradient(to right#282A35 70%transparent 100%); display:block; padding-top:5px; padding-bottom:5px; } #scroll_left_btn span:hover { background: linear-gradient(to right#000 95%transparent 100%); } #scroll_right_btn { cursor:pointer; float:left; font-size:15px; xxbackground-color:#282A35; background: linear-gradient(to left#282A35 70%transparent 100%); padding-top:5px; padding-bottom:5px; } #scroll_right_btn:hover { background: linear-gradient(to left#000 95%transparent 100%); } #menubtn_container { position:fixed; left:0; top:56px; xborder-right:10px solid rgba(404253,0.5); height:33px; color:white; font-size:15px; } #menubtn_container span { background-color:#282A35; } #darkmodemenu { position:fixed!important; right:0;!important; } #subtopnav::-webkit-scrollbar { display:none!important; } @media screen and (max-width: 992px){ #subtopnav a.subtopnav_firstitem { margin-left:50px!important; } } #google_translate_element a{ font-size:13px!important; line-height: normal; } #google_translate_element a:hover{ background-color:#fff!important; color:#000!important; } <> .topnavcontainer { background-color: #282A35; width:100%; max-width:1750px; left:0; right:0; margin:auto; height:33px; top:56px; position:fixed; z-index:3; } #scroll_left_btn { cursor: pointer; display: none; position: fixed; left: auto; top: auto; font-size: 15px; } #scroll_right_btn { cursor: pointer; position: fixed; font-size: 15px; display:none; } .topnavbackground { background-color:#282A35; position:fixed; width:100%; height:33px; top:56px; } body.darkpagetheme .topnavbackgroundbody.darkpagetheme .topnavcontainerbody.darkpagetheme #subtopnav { background-color:rgb(13,23,33)!important } body.darkpagetheme #scroll_right_btn { background: linear-gradient(to leftrgb(13,23,33) 70%transparent 100%) } body.darkpagetheme #scroll_left_btn span { background: linear-gradient(to rightrgb(13,23,33) 70%transparent 100%) }
<> .belowtopnavcontainer { max-width:1750px; margin:auto; } .contentcontainer { background-color: #ebedee; } body.darkpagetheme .contentcontainer { background-color: rgb(21,32,43); } #leftmenuinner {width:230px;} @media (max-width:992px) { #leftmenuinner {width:260px;} #sidenav{width:260px;} }

SQL Tutorial

SQL HOME SQL Intro SQL Syntax SQL Select SQL Select Distinct SQL Where SQL Order By SQL And SQL Or SQL Not SQL Insert Into SQL Null Values SQL Update SQL Delete SQL Select Top SQL Aggregate Functions SQL Min() SQL Max() SQL Count() SQL Sum() SQL Avg() SQL Like SQL Wildcards SQL In SQL Between SQL Aliases SQL Joins SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL Self Join SQL Union SQL Union All SQL Group By SQL Having SQL Exists SQL Any SQL All SQL Select Into SQL Insert Into Select SQL Case SQL Null Functions SQL Stored Procedures SQL Comments SQL Operators

SQL Database

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 Create Index SQL Auto Increment SQL Dates SQL Views SQL Injection SQL Parameters SQL Prepared Statements SQL Hosting

SQL Cert

SQL Certificate

SQL References

SQL Data Types SQL Keywords MySQL Functions SQL Server Functions MS Access Functions SQL Quick Ref

SQL Examples

SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Training

SQL Tutorial

Learn SQL

SQL is a standard language for storingmanipulating and retrieving data in databases.

Our SQL tutorial will teach you how to use SQL in MySQLSQL ServerMS AccessOraclePostgreSQLand more.

Become SQL Certified

Get certified with our SQL examincludes a professionally curated study kit to guide you from beginner to exam-ready.

CERTIFICATE OF COMPLETION This certifies that Your Name has passed the W3Schools SQL Certification exam and is hereby declared a Certified SQL Developer The candidate has passed the exam at the Professional level. Verify at verify.w3schools.com Stale Refsnes for w3schools.com

Examples in Each Chapter

With our online SQL editoryou can edit the SQL statementsand click on a button to view the result.

Example

SELECT * FROM Customers;
Try it Yourself »

Click on the "Try it Yourself" button to see how it works.


SQL Exercises

Many chapters in this tutorial end with an exercise where you can check your level of knowledge.

See all SQL Exercises



SQL Examples

Learn by examples! This tutorial supplements all explanations with clarifying examples.

See All SQL Examples


SQL Quiz Test

Test your SQL skills at W3Schools!

Start SQL Quiz!


<> .containerlog { display: flex; gap: 50px; margin: 0; font-family: Arialsans-serif; margin-right:-16px; } .left-panel { flex: 50%; } .left-panel h2 { margin-bottom: 18px; } .checklist { list-: none; padding: 0; margin: 0; } .checklist li { display: flex; align-items: center; margin-bottom: 20px; font-size: 16px; } .checklist img { width: 20px; height: 20px; margin-right: 15px; } .right-panel { flex: 50%; display: flex; background-image: url("/images/img_db2.svg"); background-repeat: no-repeat; background-size: cover; margin-top:-50px; border-radius:8px; border:1px solid #f1f1f1; } @media (max-width: 1250px) and (min-width: 993px) { .right-panel { display: none; } } @media (max-width: 860px) and (min-width: 0px) { .right-panel { display: none; } .containerlog { margin-right: 0!important; } } .darkpagetheme .right-panel { background-image: url("/images/banner_dm.png"); border:1px solid #333; }

Track Your Progress

Create a W3Schools account and get access to more features and learning materials:

  • CheckmarkView your completed tutorialsexercisesand quizzes
  • CheckmarkKeep an eye on your progress and daily streaks
  • CheckmarkJoin the leaderboard and compete with others
  • CheckmarkGet your own avatar and unlock new skins
  • CheckmarkCreate your own personal website

Sign Up »

Note

This is an optional feature. You can study at W3Schools without creating an account.


SQL References

At W3Schools you will find a complete reference for keywords and functions:

<> .ref-grid { display: grid; grid-template-columns: repeat(auto-fitminmax(220px1fr)); gap: 16px; margin-top: 20px; } .ref-box { display: flex; align-items: center; justify-content: center; background-color: #E7E9EB; border: 1px solid #ddd; border-radius: 5px; padding: 14px; text-align: center; font-size: 17px; color: #333; text-decoration: none; } .ref-box:hover { background-color: #D5D7D9; color:black; }

SQL Data Types

Data types and ranges for Microsoft AccessMySQL and SQL Server.

SQL Data Types


<> #w3_cert_cta { margin: 10px 0 50px 0; border-radius: 8px; padding: 20px; border: 1px solid #f1f1f1; } #w3_cert_cta .ws-cert-flex { display: flex; gap: 32px; align-items: center; } #w3_cert_cta .ws-cert-col { min-width: 0; } #w3_cert_cta .ws-cert-col-7 { flex: 0 0 calc(58.333333% - 16px); max-width: calc(58.333333% - 16px); } #w3_cert_cta .ws-cert-col-5 { flex: 0 0 calc(41.666667% - 16px); max-width: calc(41.666667% - 16px); } #w3_cert_cta .ws-cert-hero { padding: 0; } #w3_cert_cta .ws-cert-hero-copy { padding: 8px 20px 8px 0; } #w3_cert_cta .ws-cert-kicker { display: inline-block; margin-bottom: 18px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #04AA6D; } #w3_cert_cta .ws-cert-hero h2 { margin: 0 0 22px 0; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; color: #1f2937; } #w3_cert_cta .ws-cert-hero p { margin: 0 0 16px 0; font-size: 16px; line-height: 1.75; color: #444; max-width: 590px; } #w3_cert_cta .ws-cert-hero-actions { margin-top: 24px; } #w3_cert_cta .ws-cert-hero-actions a.ws-btn { font-size: 18px; } #w3_cert_cta .ws-cert-hero-visual { display: flex; align-items: flex-start; } #w3_cert_cta .ws-cert-hero-card { border-radius: 5px; width: 100%; position: relative; background: linear-gradient(135deg#f8fbf9 0%#f3f7f4 100%); border: 1px solid #eceff3; padding: 26px; display: flex; align-items: center; justify-content: center; overflow: visible; } #w3_cert_cta .ws-cert-hero-image-link { display: block; width: 100%; text-decoration: none; color: inherit; } #w3_cert_cta .ws-cert-hero-image { position: relative; width: 100%; max-width: 270px; margin: 0 auto; padding-bottom: 18px; } #w3_cert_cta .ws-cert-hero-image img { display: block; width: 100%; height: auto; border-radius: 4px; position: relative; z-index: 2; } #w3_cert_cta .ws-cert-badge { position: absolute; left: -22px; bottom: -18px; width: 68px; height: 68px; z-index: 2; pointer-events: none; } #w3_cert_cta .ws-cert-badge svg { width: 100%; height: 100%; display: block; } #w3_cert_cta .ws-cert-image-fallback { display: none; width: 100%; min-height: 300px; border-radius: 10px; padding: 20px; background: radial-gradient(circle at top rightrgba(4,170,109,0.18)transparent 35%), linear-gradient(135deg#ffffff 0%#eef7f2 100%); border: 1px solid #dde9e1; position: relative; z-index: 1; } #w3_cert_cta .ws-cert-image-fallback-inner { height: 100%; min-height: 258px; border-radius: 10px; border: 2px dashed #cfe6d9; display: flex; flex-direction: column; justify-content: center; padding: 24px; text-align: center; } #w3_cert_cta .ws-cert-image-fallback-small { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #04AA6D; margin-bottom: 10px; } #w3_cert_cta .ws-cert-image-fallback-title { font-size: 34px; line-height: 1.15; font-weight: 700; color: #1f2937; margin-bottom: 12px; } #w3_cert_cta .ws-cert-image-fallback-text { font-size: 17px; line-height: 1.7; color: #000; } #w3_cert_cta .ws-cert-image-fallback.show { display: block; } #w3_cert_cta .ws-cert-hero-image.hide-img img { display: none; } body.darkpagetheme #w3_cert_cta { border-color: #444; } body.darkpagetheme #w3_cert_cta .ws-cert-hero h2 { color: #fff; } body.darkpagetheme #w3_cert_cta .ws-cert-hero p { color: #ddd; } body.darkpagetheme #w3_cert_cta .ws-cert-hero-card { background: linear-gradient(135deg#252a2f 0%#1f2428 100%); border-color: #444; } body.darkpagetheme #w3_cert_cta .ws-cert-image-fallback { background: radial-gradient(circle at top rightrgba(4,170,109,0.14)transparent 35%), linear-gradient(135deg#252a2f 0%#1f2428 100%); border-color: #444; } body.darkpagetheme #w3_cert_cta .ws-cert-image-fallback-inner { border-color: #3d4b43; } body.darkpagetheme #w3_cert_cta .ws-cert-image-fallback-title { color: #fff; } body.darkpagetheme #w3_cert_cta .ws-cert-image-fallback-text { color: #ddd; } @media (max-width: 1100px) { #w3_cert_cta .ws-cert-flex { gap: 24px; } #w3_cert_cta .ws-cert-hero-copy { padding-right: 0; } } @media (max-width: 992px) { #w3_cert_cta { margin: 45px 0 65px 0; } #w3_cert_cta .ws-cert-flex { display: block; } #w3_cert_cta .ws-cert-col, #w3_cert_cta .ws-cert-col-7, #w3_cert_cta .ws-cert-col-5 { max-width: 100%; width: 100%; } #w3_cert_cta .ws-cert-hero-copy { margin-bottom: 28px; } #w3_cert_cta .ws-cert-hero h2 { font-size: 32px; } #w3_cert_cta .ws-cert-hero-visual { margin-top: 18px; display: block; } #w3_cert_cta .ws-cert-hero-card { padding: 22px; } #w3_cert_cta .ws-cert-hero-image { max-width: 290px; margin: 0 auto; padding-bottom: 16px; } #w3_cert_cta .ws-cert-badge { left: -12px; bottom: -10px; width: 62px; height: 62px; } #w3_cert_cta .ws-cert-image-fallback { min-height: 260px; } #w3_cert_cta .ws-cert-image-fallback-inner { min-height: 220px; } } @media (max-width: 600px) { #w3_cert_cta { margin: 35px 0 55px 0; } #w3_cert_cta .ws-cert-hero h2 { font-size: 29px; line-height: 1.08; } #w3_cert_cta .ws-cert-hero p { font-size: 16px; } #w3_cert_cta .ws-cert-hero-card { padding: 18px; } #w3_cert_cta .ws-cert-hero-image { max-width: 220px; padding-bottom: 14px; } #w3_cert_cta .ws-cert-badge { left: -8px; bottom: -8px; width: 56px; height: 56px; } #w3_cert_cta .ws-cert-hero-actions a.ws-btn { width: 100%; text-align: center; font-size: 17px; } #w3_cert_cta .ws-cert-image-fallback-title { font-size: 28px; } #w3_cert_cta .ws-cert-image-fallback-text { font-size: 15px; } }

<> #wrappercontainer { width:100%; height:100px; background-color:red; position:relative; z-index:2; } #footerwrapper { background-color: #282A35; /* background-image:url('/images/background_in_space.webp'); background-repeat: repeat; background-position: right bottom;*/ } #spacemyfooter { padding:40px 80px 20px 80px; max-width:1500px; margin:auto; } .footerlinks_1 { width:auto; float:left; padding:40px 60px; color:#FFF4A3; font-family: Source Sans Prosans-serif; font-size:15px; } .footerlinks_1 .fa-logo { font-size:46px!important; color:#ddd; } .footerlinks_1:nth-child(1) { padding:30px 10px 30px 40px; } .footerlinks_1 a{ text-decoration:none; } .footerlinks_1 a:hover,.footerlinks_1 a:active{ text-decoration:underline; color:#FFF4A3; } .footerlinks_1 a:hover,.footerlinks_1 a:active{ text-decoration:underline; color:#FFF4A3!; } .footerlinks_1 a:hover i{ color:#FFF4A3!important; } .footerlinks_2 { width:auto; float:left; padding-left:90px; padding-right:135px; color:#ddd; font-family: Source Sans Prosans-serif; font-size:12px; line-height:15px; text-align:center; } .footerlinks_2:nth-child(4) { padding-right:0; } .footerlinks_2 h5 { margin-bottom:20px; } .footerlinks_2 a:visited,.footerlinks_2 a:link{ text-decoration:none; } .footerlinks_2 a:hover,.footerlinks_2 a:active{ color:#FFF4A3; } .footersome { padding:60px 40px 10px 40px; color:#ddd; font-size:20px; text-align:center; } .footersome a { margin-right:10px; } .footersome a:hover,.footersome a:active{ color:#FFF4A3; } .footersome .textlink { font-size:15px; text-decoration:none; } .footersome .textlink:active,.footersome .textlink:hover { text-decoration:underline; } .footertext { color:#ddd; font-size:12px; line-height:15px; text-align:center; } .footertext a:hover,.footertext a:active{ color:#FFF4A3; } @media screen and (max-width: 992px) { #wrappercontainer { z-index:0; } .footerlinks_1 { width:100%; margin:auto; float:none; text-align:center; padding:10px 20px!important; font-size:20px; } .footerlinks_1:nth-child(1) { padding:40px 20px; } .footerlinks_2 { width:100%; float:none; margin:auto; font-size:16px; line-height:20px; padding:0; } .footerlinks_2 h5 { font-size:26px; margin-top:40px; } .footertext { padding:0; } .footer-hide-special { display:none; } } /* @media screen and (max-width: 992px) { #footerwrapper { background-image:url('/images/background_in_space.webp'); background-color: #282A35; background-repeat: repeat; background-position: left top; } }*/
<> @media screen and (max-width: 1450px) { #spacemyfooter { max-width:1100px; } .footerlinks_1 { padding-left:30px; padding-right:30px; } .footerlinks_2 { padding-right:30px; } .footerlinks_2:nth-child(1) { padding-left:50px; } .footer-hide-special { display:none; } } @media screen and (max-width: 1100px) { #spacemyfooter { max-width:1000px; } .footerlinks_1 { padding-left:20px; padding-right:20px; } .footerlinks_2 { padding-right:20px; } .footerlinks_2:nth-child(1) { padding-left:20px; } }
<> /*Remove this after 20. April 2024*/ #err_message { padding:8px 16px 16px 40px; border-radius:5px; display:none; position:relative; background-color:#2D3748; color:#FFF4A3; font-family:'Source Sans Pro'sans-serif; } #err_message h2 { font-family:'Source Sans Pro'sans-serif; } #err_message p { color:#f1f1f1; } #err_message #close_err_message { position:absolute; right:0; top:0; font-size:20px; cursor:pointer; width:30px; height:30px; text-align:center; } #err_message #close_err_message:hover { background-color:#FFF4A3; color:#2D3748; border-radius:50% }
×

Contact Sales

If you want to use W3Schools services as an educational institutionteam or enterprisesend us an e-mail:
[email protected]

Report Error

If you want to report an erroror if you want to make a suggestionsend us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorialsreferencesand examples are constantly reviewed to avoid errorsbut we cannot warrant full correctness of all content. While using W3Schoolsyou agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

-->