Town Field Poem:
——— Dream who feel, the water month Build blog. Baiqian tribulation, only know the vicissitudes of the world.
——— today holds the Buddhist language, the technology is boundless willing to learn. Willing to do what you learn, cast a conscience blog.
——————————————————————————————————————————
1 Base Code
1 UseMaster2 Drop DatabaseHelloWorld3 4 --Create a database5 Create DatabaseHelloWorld6 7 --use helloworld1 this database8 UseHelloWorld9 Ten --Create a table teacher One Create TableTeacher A ( -Idint Primary Key Identity(1,1), -Namenvarchar(Ten), theClassnchar(2), -Scorevarchar(5) - ) - + Create Table Location - ( +Classnchar(2), ALocationnvarchar(5) at ) - - --look at teacher, what's this form? - Select * fromTeacher - Select * from Location - in --insert these lines of content into this teacher, which I insert once, simply modify, and insert again - Insert intoTeacher to Values('burning lamp Ancient Buddha','Buddhist',' -'), +('Buddha Buddha','Buddhist',' -'), -('Maitreya Buddha','Buddhist',' -'), the('Buddha Buddha','Buddhist',' -'), *('nu wa Niang','Taoism',' -'), $('Buddhist Bodhisattva','Buddhist','103'),Panax Notoginseng('The Buddha','Buddhist','102') - the --insert these lines into this location + Insert into Location A Values('Buddhist','India'), the('Taoism','China'), +('Christ','Western'), -('Confucian','China') $ $ --see what's in the teacher table - Select * fromTeacher
2 Base Code Show
3 Get a query result for a horizontal table
1 -- get a horizontal table 2 Select Max (score) as ' Highest Achievement ',Max( The longest number of characters in thelenas Name table 'from Teacher
4 show
5 get a query result of a vertical table
1 --Get a vertical table2 --Column name of content column in columns3 Select 'Highest Achievement' as 'Description Information',Max(score) as 'Results' fromTeacher4 Union5 Select 'Longest name in the table' as 'Description Information',Max(Len(Name)) as 'Results' fromTeacher
6 Show
——————————————————————————————————————————
The essence of the blog, in the technical part, more in the town yard a poem.
Sqlsever is a good language, worth studying hard. Familiar with the database of additions and deletions, write procedures necessary.
If the content of the post can be improved, or even the wrong place, please leave a comment, I will try to correct, strive to cast a conscience blog.
Note: This article is only as a scientific research study, if I inadvertently violated your rights and interests, please be sure to timely inform, I will make corrections.
Sqlsever Base union turns the resulting horizontal table into a vertical table