SQL Classroom Essay ...

Source: Internet
Author: User
Tags mssqlserver query meaning

the IP address of the computer where the SSMS database service resides

. Cocal//The original meaning exists in the. mdf file

SQL Database Platform Create a table, delete and change the search

net stop MSSQLServer stop

NET start MSSQLServer run

. mdf data file, with only one

. ldf log file, with and at least one

Table, regional division. There are n tables in a database

CREATE TABLE Tables

* All the Where. Filter criteria

Primary key primary key identity invariant constant, (,) self-growth

//code int primary key, set the serial number of the primary key

The varchar (max) data type is the meaning of a string, and the following max is infinitely large.

// name varchar (NOT NULL),

INSERT into what inside (insert to a location) values value Standard

// intsert into+ table name +values (input data content)

Select Pick from

// select*from+ table name // query meaning

Delete Delete drop Delete (large) Table Form from

//Delete from+ table name + where code=2 // Delete the school number from this table is the local content of 2

Update correction, fix set I'm about to change to a value where I'm going to find a value and and

//update+ table name +set sex= ' 0 ', age=22 where code=4

Between from where to where is like greater than-less than

Create DATABASE Database

Not NULL cannot be empty

Distinct go to ORDER by sort ASC---ascending desc---Descending

//Select*from student12 ORDER by age asc,cm, kg desc-------// do not change the first set of sorting results on the basis of the second order is not out of line.

//-----Group By column, the column is grouped to show only which column
Select name from student12 GROUP BY name---//grouping a column, which is equivalent to re-displaying

Write an exercise:

CREATE TABLE student12 creates a data table---------------student12
(
Code int primary Key identity, --Set the primary key for the ordinal to be sorted out in order
Name varchar (NOT NULL),
Sex varchar (not null),
The age int is not NULL,
SG int NOT NULL,
Wuqi varchar () NOT NULL,
Dizhi varchar (max) is not NULL,
)

INSERT into student12 values (' Rick ', ' Male ', 18,175, ' Luoyang shovel ', ' Shadow Island '); --First person, John Rick, male, 18 years old, height 175cm, weapon is Luoyang shovel, from Shadow Island
INSERT into student12 values (' Lacus ', ' Male ', 25,188, ' Tsing Lung Yan Yue Dao ', ' Ella Table de ');
INSERT into student12 values (' brand ', ' Male ', 22,180, ' blazing ', ' Noxus ');
INSERT into student12 values (' Zeeras ', ' Male ', 17,179, ' Arcane thunder ', ' Ayonia ');
INSERT into student12 values (' Olivia ', ' female ', 20,170, ' Mechanical ball ', ' Ayonia ');
INSERT into student12 values (' Galen ', ' Male ', 25,185, ' Great Sword ', ' Demacia ')
INSERT into student12 values (' Galen ', ' Male ', 28,190, ' Great Sword ', ' Demacia ')

Go

Select*from student12 Select*from student12 where cm>=170 and kg>=65-------query

Go

Update student12 set name= ' Lacus ' where name= ' pretty king ' --set I'm about to change to a value where I'm going to find a value where the Lacus is already changed after the run

Select*from student12 where kg between 65and 70

Select*from student12 where name like ' about% ' --like seems to mean that the percent semicolon means about the back can have any word

Select*from student12 where name like '% pull% ' --find the person with the word "pull" in the name, the percent can also be in front, find the name behind the "pull"

Update student12 set age=16 where code=7 --Change Code

Delete from student12 where code=5 --delete Code5 this line

Delete from student12 where code between and --delete rows 10th through 13th data

drop table student12--Deleting tables student12

Drop database Yuelie--delete the databases Yuelie

CREATE DATABASE Yuelie--Creating databases

Delete from student12 where code=6 and---Delete the first few lines

Select top 3*from student12 where age>=20 ----------* represents all top rows

SQL Classroom Essay ...

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.