当前位置:网站首页>Only these four instructions are required to operate SQL data
Only these four instructions are required to operate SQL data
2022-06-25 05:21:00 【VFP of Garfield】
Now the community has started to have zero base members , It seems that Maomao also wants to write some zero basic articles .
First of all, you should learn to install MSSQL database , There are corresponding tutorials on the Internet , It's very detailed .
Once again, learn how to build databases and tables .
MSSQL Provides a Microsoft SQLServer Management studio, Just create a database and a table here .
Here is a place to pay attention to ,n Type at the beginning ,VFP At present, it is not recommended to use . such as nvarchar(50)
I gave directions here , Baidu to find the answer , If you find , Still can't find , You can contact cat cat to help you find .
The most important thing in software development is to solve problems , The above is to solve two problems , Database system installation , Database building, database building and table building .
After the table is built , Let's learn how to manipulate data ,
At the end is SQL How to learn instructions ?
stay SQL The string in the statement is in single quotation marks 、 Single equal sign . select *、SeLeCT *: SQL Statements are case insensitive .
VFP Supported by SQL You can use double quotation marks , But in MYSQL ,MSSQL It's not allowed inside .
open Microsoft SQLServer Management studio
After inputting the instructions , You can click execute to see the result .
preparation
You can also create a table by entering the following commands in the query interface , You can also use the designer to create .
create table Student
(-------------- Create a student information table
sId int identity(1,1) primary key,----------------- auto number
sName nvarchar(50) not null,
sAge int not null,
sNo numeric(18,0),----------------------- ID number , Eighteen digits , The decimal is
sSex char(2) not null,
sEmail varchar(50)
)
## Insert data into insert
Insert a row into the table ( Each column of this row has data )
insert into surface ( Name , Name ) values( value 1, value 2)
insert student (sName,sAge,sNo,sSex,sEmail) values(‘ Zhang San ’,20,1,‘ male ’,‘[email protected]’)
insert student (sName,sAge,sNo,sSex,sEmail) values(‘ Wang Wu ’,18,1,‘ male ’,‘[email protected]’)
insert student (sName,sAge,sNo,sSex,sEmail) values(‘ Li Si ’,18,1,‘ male ’,‘[email protected]’)
## Data query
- Query all columns
select * from student - Query specified column
select sName,sAge from student - Specified condition query , Search for names = Zhang San's line
select * from student where sName=‘ Zhang San ’ - Count , Query the number of records
select count(*) from student - Sum up , Query the sum of all ages
select sum(sAge) from student
## Data update update( Data modification )
- Update a column :update Student set sSex = ‘ male ’
- Update multiple columns : update Student set sSex =‘ Woman ’,sAge = 18
- Update some data : update Student set sClassId= 4 where sClassId = 1, use where Statement means that only Name yes ’tom’ The line of , Be careful SQL Medium equals to judge with a single =, instead of ==.
Where Complex logical judgments can also be used in update Student set sAge=30 where sName=‘ Hua Tuo ’ or sAge<25 ,or Or - The age of all students plus 1update Student set sAge = sAge + 1
update Student set sClassId=6
where (sAge>20 and sAge<30) or(sAge=50)
Where Other logical operators that can be used in :(||)or、(&&)and、(!)not、<、>、>=、<=、 <>( or !=) etc.
priority :
not and or, You can change the priority with parentheses .
Data deletion
Delete all data in the table :DELETE FROM Student.
Delete Delete data , The watch is still there .
Delete You can also bring where Clause to delete part of the data :DELETE FROM Student WHERE sAge > 20
We are currently learning to test in management tools , How to use it in the Qiyou three-tier development framework ? see MSSQLHelper With your help .
Look at a lot of content , It is seldom done , Copy the code for an hour every day , You can learn .
More information :www.sn58.cn
边栏推荐
- Page electronic clock (use js to dynamically obtain time display)
- PHP calls map API
- Go Basics
- H5 native player [learn video]
- Could not find “store“ in the context of “Connect(homePage)
- Penetration information collection steps (simplified version)
- How to make colleagues under the same LAN connect to their own MySQL database
- A review of small sample learning
- How to download and use Xiaobai one click reload on the official website
- 2022.1.21 diary
猜你喜欢
随机推荐
Basic bit operation symbols of C language
2021-10-24
Deeply understand the characteristics of standard flow and off standard elements
Various pits encountered in the configuration of yolov3 on win10
Laravel Aurora push
Critical dependency: require function is used in a way in which dependencies
Jason learning
UVA816 Abbott’s Revenge
IronOCR 2022.1 Crack
Integrate CDN to create the ultimate service experience for customers!
Rce code execution & command execution (V)
Edge loss interpretation
电子协会 C语言 1级 28 、字符菱形
Drag modal box
Basic knowledge of web pages (URL related)
2021-04-02
Precise delay based on Cortex-M3 and M4 (systick delay of system timer can be used for STM32, aducm4050, etc.)
Fundamentals of C language
The print area becomes smaller after epplus copies the template
Working principle of asemi three-phase rectifier bridge









