:(1) A target column is not a simple attribute name, but a clustering function or column expression, or a target column *(2) several fields with the same column as the view are selected for multi-table join.(3) You need to enable a new and more appropriate name for a column in the view.
When RDBMS executes the create view statement, it only saves the VIEW definition to the data dictionary and does not execute the SELECT statement. When querying a view, data is retrieved from the basic table acco
/*Title: 50 SQL statements involved in a project (sorted Version)Author: AI xinjue Luo. Xin Hua)Time: 2010-05-10Location: Chongqing aerospace Vocational CollegeNote: The following 50 statements have been tested according to the test data. It is best to run only one statement at a time.Problem and description:-- 1. Student tableStudent (s #, sname, sage, ssex) -- s # student ID, sname Student name, sage year
-four billion bytes. When it comes to shuodan, zhenlai receives the letter. As the time goes, heaven and earth shall be refined, and every day and month shall be held together. Xiongyang broadcast Xuan Shi, female Yin yellow package. Chaotic phase transition, the foundation of privilege tree. After the nutrition, the gods become bodies. All the people are confused. [Saint's fourth chapter] Zhong nizan hongmeng, Qian Kun de Dong Xu, Gong Gu dang yuan Huang, Guan Yu was founded at the beginning
Stored Procedure zhuanzhang)
1. execute zhuanzhang 'a, 'B', 50002. execute zhuanzhang 'C', 'D', 5000Note the result changes.
Http://blog.csdn.net/cnlht/archive/2007/12/19/1953032.aspxUse CASE structure in queries
Use CASE structure to classify query results
Example 1:Select zkzh Admission Ticket No., xm name, total score =CaseWhen zcj = 0 then 'failed'When zcj = 1 then 'pass'When zcj = 2 then 'good'When zcj = 3 then 'excellent'Else 'error'EndFrom ncre26
Questions:1. How to classify the grade qu
Select [name],
Isnull (sum (case subject
When 'China' then result
End), 0) as 'China ',
Isnull (sum (case subject
When 'mate' then result
End), 0) as 'mat ',
Isnull (sum (case subject
When 'physical 'then result
End), 0) as 'physical'
From student0
Group by [name]
Copy codeThe Code is as follows: -- A subquery uses a query statement as a result set for other SQL statements, just like using a common table,-- The query statement used as the result set is called a subquery. Almost all tables that
[name],Isnull (sum (case subjectWhen 'China' then resultEnd), 0) as 'China ',Isnull (sum (case subjectWhen 'mate' then resultEnd), 0) as 'mat ',Isnull (sum (case subjectWhen 'physical 'then resultEnd), 0) as 'physical'From student0Group by [name]Copy codeThe Code is as follows:-- A subquery uses a query statement as a result set for other SQL statements, just like using a common table,-- The query statement used as the result set is called a subquery. Almost all tables that can be used can be r
MySql database data update operation its advanced application bitsCN.com
MySql database data update operations on its advanced applications
There are three types of data update operations: add data to the table, modify data in the table, and delete data in the table.
The data table used for demonstration uses three data tables: student, course, and SC. the specific content of the data table is in the PHP and MySql databases. how to obtain the total number of records for each category
Insert da
to understand the simple use of stored procedures, so all the examples are simple.No parameter stored procedure:Select all the information in the student table,Create proc StuprocAS//here cannot be omitted without writingBegin//begin and end are a pair, you cannot write only one, but you can never writeSelect S#,sname,sage,ssex from StudentEndGoThere are parameter stored procedures:Global variablesA global variable, also known as an external variable
SET ANSI_NULLS onGOSET QUOTED_IDENTIFIER ONGOWhen SET QUOTED_IDENTIFIER is on, identifiers can be delimited by double quotation marks, and literals must be separated by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers are not quoted and must conform to all Transact-SQL identifier rules.The SQL-92 standard requires that the value be FALSE when the null value equals (=) or does not equal (When SET Ansi_nulls is OFF, the Equals (=) and not Equals (No parameter stored procedure
Mt. Wuzhishan
Description
The Sun Guo in the journey to the Great Heaven, Buddha ancestors came to yield him, said: "I play a game with you, if you have the ability, a loop out of my right hand, count you win, and then do not move Sword bitter war, please the Jade Emperor to live in the West, the Heavenly Palace let you, if you can not play the palm, you also the Nether for the demon, and then a few "The sage
SQL database Interview Questions and answers
(22:52:54)
ReprintedBytes
Summary of course number of three c courses by Ye Ping
Category: Program World
Student (S #, Sname, Sage, Ssex) Student table S #: Student ID; Sname: Student name; Sage: Student age; Ssex: Student genderCourse (C #, Cname, T #) curriculum C #, Course No.; Cname: Course name; T #: Instructor No.SC (S #, C #, score) Student table S #: Stud
# First: Design a global variable to hold a number of student information, students (student number, name, age), and how the structure of the thinking to be preserved;# The second question: on the basis of the first question, complete: Let the user enter a new student information (school number, name, age); You save it in a global variable, and provide the user with the ability to see how many students are currently available;# The third problem: to provide users with the number of students to v
character set+----------+---------------------------------------------------------------+| Database | Create Database |+----------+---------------------------------------------------------------+| DAY15 | CREATE DATABASE ' day15 '/*!40100 DEFAULT CHARACTER SET GBK */| |+----------+---------------------------------------------------------------+1 row in set well, it's been changed to GBK.Modify database Alter DAY15; Modify the database notationView database show databases;add databases; creata d
previous column properties are the same, then sort by the column properties that follow. (The prerequisite must satisfy the previous order of the attributes because of the higher precedence in front).
Example 2:
SELECT * from S
ORDER by sname Desc, Sage desc
First sorted by sname descending, followed by the same as XX, sorted in descending order of sage. (The default
(not nul) ); 4. Add Column Sex ALTER TABLE student add column Sex char (2) not NULL after name; 5. Delete Column Sex ALTER TABLE student drop column sex; 6. Modify the column name, type ALTER TABLE student change sex ssex bit not null; 7. Database Insert Data INSERT into student (Name,sex,age) VALUES (' Zhang San ', ' Male ', 18); 8. Updating table data Update student set sex= ' female ' where id = 3; 9. Delete data from a table Delete from student where id = 2; 10. Check all information SELECT
. Query student's school number, grade, name, course nameSelect Sc.sno,sname,cname,grade from Sc,student,coursewhere Sc.sno=student.sno and Sc.cno=course.cno--8. Cross-linking of students and departments respectively, inner connection, outer connection--Inner Connection:SELECT * FROM student, dept where Student.dno=dept.dno;--External connection:SELECT * FROM student LEFT OUTER join dept on (STUDENT.DNO=DEPT.DNO);--9. Take the student's number and name in advanced mathematicsSelect Sname, sno fr
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.