intoScoreValues(3,'3-105', -)Insert intoScoreValues(4,'3-105', -)Insert intoScoreValues(5,'3-105', -)Insert intoScoreValues(6,'3-105', -)--Business: To ensure the complete implementation of the entire process, all without problems, unified submission, once there is a problem, back to the origin. Like bank transfers.Begin Tran--z The start of the transaction--start writing the process statement--After the statement is finishedIf @ @ERROR >0Rollback tran--ROLLBACK TRANSACTIONElseCommit Tran--
50 common SQL statementsStudent (S #, Sname, Sage, Ssex) Student tableCourse (C #, Cname, T #) CurriculumSC (S #, C #, score) Orders tableTeacher (T #, Tname) Instructor tableProblem:1. query the student ID of all students whose score is higher than that of the "002" course;Select a. S # from (select s #, score from SC where C # = '001') a, (select s #, scoreFrom SC where C # = '002') BWhere a. score> B. sc
50 common SQL statements
Student (S #, Sname, Sage, Ssex) Student tableCourse (C #, Cname, T #) CurriculumSC (S #, C #, score) Orders tableTeacher (T #, Tname) Instructor table
Problem:1. query the student ID of all students whose score is higher than that of the "002" course;Select a. S # from (select s #, score from SC where C # = '001') a, (select s #, scoreFrom SC where C # = '002') BWhere a. score> B.
This text has been reprinted online, and some SQL statements are suitable for use in application systems. Some "reports" have a heavier feeling, mainly to review the former.
This text has been reprinted online, and some SQL statements are suitable for use in application systems. Some "reports" are more likely to be used, mainly to review the former.
50 common SQL
Tags: blog use problem div code HTML Management logTo manage the job training information, establish 3 tables:S (S#,SN,SD,SA) S#,sn,sd,sa respectively represents the student number, the student name, the unit, the Student Age C (C#,CN) C#,CN respectively represents the course number, the course name SC (s#,c#,g) S#,c#,g respectively represents the student number, the elective
course (-59) Good (-80) Excellent (-100) Select Subject, (selectcountfromwhere and as failed, ( Select Count from where between and and as benign, (selectcountfromwhere and as excellent from Group by subject 13. Mathematics: Zhang San (50 points), John Doe (90 points), Harry (90 points), Zhao Liu (76 points) Declare @s varchar (1000) Set @s='select@s =@s+', '+name+' ('+convert (varchar(), score) +' points 'fromwhere subject=' mathematics ' Set
Tags: SQL statementsDevelopment Course do practice Student Guide 051 les01 pptOracle often connects two tables, called a third paradigm, such as something with an ID characterThe following is the command for the SQL statementSELECT * from departments; Department tableSELECT * FROM Employees; Employee tableSelect Employee_id,rowid,rownum from Employeeswhere employ
After more than half a year of hard work, the book ASP. NET 3.5 + SQL Server website modular development full recording was finally successfully published by Tsinghua University Press.
The first time such books were published, there may inevitably be a lot of mistakes, but we hope that the majority of readers will not correct or criticize them. The readers of this book are: beginners and intermediate website developers, taking into account some basic
There is a student table with three columns in total. The first column is the student ID column, which stores the student ID of the Course Selection. You can repeat it to allow one student to select multiple courses.
The second column is the course column, that is, the name of the course selected.
The third column is the score column, that is, the score of the
An SQL statement is used to query the names of students whose scores are greater than 80 in each course. There are three tables: S, C, and SC S (Sno, Sname) C (Cno, Cname) SC (Sno, Cno, grade) -------------------------------------------------- problem: use an SQL statement to query the names of students whose scores are greater than 80 in each
('John Doe','Mathematics',' -'); - INSERT into' Grade 'VALUES('Harry','language','Bayi'); + INSERT into' Grade 'VALUES('Harry','Mathematics',' -'); A INSERT into' Grade 'VALUES('Harry','English',' -'); at SETForeign_key_checks=1;View CodeCheck the names of students who have more than 80 points for each course:1 Select distinct from where not inch (Selectdistinctfromwhere score);View CodeThere is also a simple notation:1 Select from Group by ha
In SQL Sever 2008, if you need to query the top 3 of each course, the implementation is as follows:Existing score table (result), column (Studentno, subjectno account number, Studentresult student score)Method One:SELECT distinct b.* Fromresult as RCross APPLY (SELECT TOP (3) *from Result WHERE r.subjectno= subjectno ORDER by Studentresult DESC) as BOrder by Subjectno, Studentresult descCross apply () use t
Label:Today, I mainly review the previous sub-query, and then learn the connection query join on the content.Such as: Select Renyuan.code,name,age, Sex, Bumen.bname,bceo from Renyuan,bumen where Renyuan.bc=bumen.bcodeWrite the above query statement as a connection query:Select Renyuan.code,name,age, Sex, Bumen.bname,bceo from Renyuan joins Bumen on Renyuan.bc=bumen.bcodeAfter that, I learned about local variables.Cases:DECLARE @code intSet @code =10003Select age from Renyuan where [email protec
to a consistent state at the time of the most recent dump.2. Load the corresponding log file copy to redo the completed transaction* Checkpoint (Checkpoint)* When the system is restored, the entire log file needs to be searched to determine whether the transaction was aborted or completed.1. The search process is too time consuming2. Most transactions that need to be re-made have their updates written to the database. Although they do not have adverse consequences for their re-But it will make
Label:Build table: 1 Create TableScore (2Namevarchar( -),
3Coursevarchar( -),
4Scoreint)
5
6 Go
7
8 Insertscore9 Select 'Hanmeimei','Chinese',Bayi Union All
Ten Select 'Hanmeimei','Mathematics', the Union All
One Select 'Hanmeimei',' History',Bayi Union All
A Select 'Hanmeimei','Geography', the Union All
- Select 'Lilei','Chinese', the Union All
- Select 'Lilei','Mathematics', - Union All
the Select 'Jimgreen','Chinese',Bayi Union All
- Select 'Jimgreen','Mathematics', -
();}2. Parameters of the array typeProgram codeSELECT * from T_blog where ID in#{item}Correspondence MapperProgram codePublic list3. Parameters of the Map typeProgram codeSELECT * from T_blog where title like "%" #{title} "%" and ID in#{item}The mapper should be such an interface:Program codePublic listthrough the above method, we can complete the general MyBatis dynamic SQL statement. The most common is if where foreach these, must focus on masterin
Tags: Oracle training Oracle Video Oracle Database tutorial Oracle Video Tutorial Oracle Video tutorial goals NBSP;NBSP;NBSP; Oracle video tutorial, wind Brother this set of Oracle Tutorial Training learning Oracle Sql*loader Concepts and usage and sql* Loader two cases, while the courseware with nearly 20 cases for everyone to practice their own. Applicable people It related practitioners, Oracle d
statement queries the number of employees in the department, where the ID and name of the employee are from the employee table, people_num from the Department table:The other Connection statement format is using the join on syntax, which is equivalent to the following statement:SELECT id,name,people_numFROM employee JOIN departmentON employee.in_dpt = department.dpt_nameORDER BY id;The result is the same as the statement just now.Second, practice1, using the method of connection query, the numb
Tags: pt-killPercona Pt-kill Lite VersionAdd more slow SQL Mail alerts after killing is sentNote: The official original version of the default is killed by the SQL will not send mail, which will not be able to notify the development of timely, the troubleshooting problems caused confusion.Students who purchase a course can log inHttp://edu.51cto.com/
Tags: str utf8mb4 greater than ADE where name group drop coreUse an SQL statement to find out the names of students with more than 80 points in each course, with the following data table structure: The table SQL is built as follows: SETForeign_key_checks=0; -- ----------------------------
--Table structure for grade
-- ----------------------------
DROP TABLE IF
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.