foreign key? In the table Dicttype TypeCode is the primary key, the primary key is unique, then is TypeCode is unique, then dictinfo.typecode to match dicttype inside the TypeCode only one record, which means that only a single record can be returned, that is, if the CodeType in the Dicttype is not unique, then it will find out a number of records, then it is not inside the connection. Example 2: One more example: do a data query using the internal connection method. Assuming that there ar
column_name operator value add/or column_name2 operator
value2 ORDER by column_name,column_name2 Asc/desc; Cases: 1, insert a piece of data to table 1 Insert TB1 VALUES ("id", "name", "Age", "Code", "Class" ...); 2. Change the school number of the person named Zhang San in table 1 to 001 Update tb1 set code= "001" where Name= ' Zhang San '; 3. Delete data older than 22 in table 1 Delete from tb1 where age>22 4, query table 1, age is equal to 22 years old and the name is called Zhang San
* FROM [user] WHERE u_name like ' old [^1-4] ';Will exclude "old 1" to "Old 4", Looking for "old 5", "Old 6" 、......5. When the query contains a wildcard characterBecause of the wildcard character, which causes us to query the special characters "%", "_", "[" the statement can not be implemented normally, and the special characters with "[]" in the normal query. Thus we write the following function:
function Sqlencode (str)Str=replace (str, "[", "[[]") ' This sentence must be in
Label:The table structure of the course selection system is as follows:Student table: Student (Sno,sname,sex,age,class)Timetable: Course (cno,cname)Selected timetable: SC (Sno,cno,score)(1) Inquiry into the "database application" student number and name(2) The name and number of students who have enrolled in 3 courses?For example, do the following test data:(1)Select Sno,sname from student where Student.sno in (select Sno from SC where sc.cno= (select CNO from course where course.cn Ame= "Databa
AEXECUTE dbo. Employees_getallbyname @FirstName = N'Nancy',--nvarchar (Ten) the@LastName = N'Davolio'--nvarchar ( -) + - $--4. Returning multiple result sets $IF object_id ('Getmanyresultscount','P') is not NULL - DROP PROCEDURE getmanyresultscount; - GO the CREATE PROCEDURE Getmanyresultscount - asWuyiSELECT COUNT (*) from dbo. Orders; theSELECT COUNT (*) from dbo. Employees; - GO Wu ---Executing stored procedures About EXEC Getmanyresultscount; $ ---stored procedures that use the OUTPUT
Summary and review of SQLServer. If you are studying sqlserver, refer
SQL Server summary and review. If you are studying SQL Server, refer
1. ranking function and PARTITIONThe Code is as follows:
-- All data
SELECT * FROM dbo. student AS a inner join dbo. ScoreTB AS B ON a. Id = B. stuid
WHERE scorename = 'China'
--
SQL Server summary and Review (2) for more information, see.
SQL Server summary and Review (2) If you want to learn, refer to it.
1. ranking function and PARTITION
The Code is as follows:
-- All dataSELECT * FROM dbo. student AS a inner join dbo. ScoreTB AS B ON a. Id = B. stuidWHERE scoren
SQL Server advanced content table expressions and review 1. table expression (1) uses a table as a source or a query result set as a source to process the source and obtain a new data source for query. (2) (3) to derive a table, use the result set obtained by the table query as a new data source. Note the following points: 1) the derived table must
SQL Server adv
statementsBegin Try...end TryBegin Catch...end Catch -- 1. Variables
Declare @name nvarchar (ten) -- Statement
Set @name = ' Wuhan University ' -- Assign Value
Print @name -- Output View Code --SELECT statement
Declare @id int
Set @id=Ten
if @id>5
begin
--when the condition is met, execute the following code
Print 'OK'
End
Else
begin
--when the condition is not met, execute the following code
Print 'No'
End
--Loops
Declare @id int
Set @id=1
while @idTen
begin
Print @id
Recommended Tools: If the machine configuration is low, you can install gsql this tool to obtain the SQL execution environment (as a manual view built-in data type functions and stored procedures, etc.)--Before the database things touch not much, although the basic syntax is to understand, but not very familiar with--recent projects have been tossing stored procedures (some data logic is implemented through stored procedures on the database side),--A
I have been learning about SQL Server recently. I took a test yesterday. It's really not easy. In particular, some complex queries. It makes me dizzy. However, it is also because your knowledge is not solid enough. So today I reviewed the addition, deletion, modification, and query of the T-SQL statement. Many of them are indeed forgotten. Write the result. Don't forget it in the future.
--
Parameters property, one parameter with the Add methodcmd. Parameters.Add (NewSqlParameter ("@name", TextBox1.Text)); Conn. Open (); inti =Convert.ToInt32 (cmd. ExecuteScalar ()); MessageBox.Show (i.ToString ()); } } }}View CodeParameterized statement execution procedure:(1) Open Database Tools ->profier tool (Database Analysis monitoring tool)(2) Execution code: Enter a ' or 1=1 or 1 = 'After clicking the button(3) Then look at the profiler.EX
and degree column.Select Sno,cno,degree from score where degree= (select MAX (degree) from score) Select top 1* from score order BY degree DESC --The 43rd query and "Li June" with the sex of all students sname.Select Sname from student where ssex= (select Ssex from student where Sname= ' Li June ') and Sname not in (' Li June ') --The 44th query and "Li June" with the same sex and classmates sname.Select Sname from student where ssex= (select Ssex from student where Sname= ' Li June ') and Snam
Tags: ram title res src mysql long locale. exe JDB1 using JDBC for bulk execution SQL in the actual project development, sometimes you need to send a batch of SQL statement execution to the database, you should avoid sending execution to the database, but should adopt the batch processing mechanism of JDBC, in order to improve the execution efficiency. Package dbex.mysql;
Import java.io.IOException;
Import
comma between the column names. The sort method can be DESC and ASC (Ascending), ASC by defaultUNIQUE: The index can take either a clustered index structure or a nonclustered index structure, and the SQL Server system defaults to a nonclustered index structure if the index structure is not specified.Create Unique Index on desc);1.42 Delete Index Syntax:Drop INDEX Drop Index on EMP;1.43 Display index Information:Show index from Tbname;Former part re
Below are some simple summary and review of the SQL script. Most of them refer to Boyou, And I have rewritten it myself.
-- Create a database use ainfolianggoif exists (select * From sys. databases where name = 'ainfoliang ') begindrop database ainfoliang -- print '1' endgocreate database ainfoliangon (name = 'ainfoliang', filename = 'C: \ ainfoliang. MDF ', size = 5, -- the initial size of the database ma
MySQL study note _ 8_ SQL BASIC Language Review SQL language basic review
I. Overview
SQL statement comments
1) All contents starting with "#" until the end of the line are comments
2) All content starting with "--" (-- and then a space) until the end of the line is annotated.
3) All content ending with "/*" and endin
Tags: ar sp strong on BS new as SQL userA stored procedure is a collection of compiled T-SQL statements that can be called at any time, fast and error-prone.Parameters can be passed, common parameters and output parameters (outputs)Example 1Create proc Newpro@testVarA int,@testVatB int,@testSum int OutputAsBeginset @[email protected][email protected]EndCall the stored procedure NewproDECLARE @testA intExecu
Title: Five Star Review Remote SQL Injection (recommend. php)
Developer: http://www.review-script.com
Affected Version: Versions below v5.1
Author: EthicalPractice www.2cto.com
Test Platform: Firefox 8.0, Palemoon 8.0, and Internet Explorer 9
Note: Only for old versions
######################################## ######################################## ################
# Injection point:/recommend. p
and:
Select sum (Sal+ifnull (comm,0 from EMP;
To count all employees ' average salary:
Select avg from EMP, or Select sum (SAL) / Count from EMP;6.3 Max and Min
Check the maximum wage and minimum wage:
Select Max (SAL),min from EMP;7 Group queries When grouping queries are required, you need to use the GROUP BY clause, such as querying the payroll for each department.7.1 Group Queries
Query the department number of each department and the salary of ea
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.