Preface (i.e. some nonsense)
in the before learning SQL Server database, our teacher just finished the database principle this course, said is finished, actually only talked about the seventh chapter part, the back did not say. We use the textbook is Shi Bole the third edition of the database system tutorial, I learned is a do it, on the machine class, the teacher uses an access database, so I have access to a little there was a little bit of Oracle database last year, and the MySQL database was simply used when learning Java .
Usually referred to as the database, refers to the database corresponding management software.
Once heard that the database is not difficult, it is difficult to use the database management software, indeed, if not to find tutorials or guidance, not only will not properly install the database management software, and will not uninstall the software. For some reason, I now start to look at SQL Server database, I feel this software for the novice, it is really difficult, now will learn some of their knowledge and some experience summed up, for themselves in oblivion can have memories, Also hope to be able to help some novice.
about installing software
First of all, install SQL Server, software I was copied from the classmate, as for the installation of the tutorial, see here-http://shaojiang216.blog.163.com/blog/static/ 13132582420136207638154/
I feel this is good, I just see this tutorial installed SQL Server .
The SQL Server database generates a database file suffix of . mdf, which generates a corresponding transaction log file suffix of . LDF
Let's start with some of the problems I've encountered in learning to use this database and some points of knowledge.
The first problem is that, for some reason, you can use Windows Authentication to connect to the local database properly, but instead of using SQL Server authentication to connect, this error always occurs--650 this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/53/CC/wKioL1RwgPijYLwYAADenI7XEMQ734.jpg "title=" 1-1.jpg " alt= "Wkiol1rwgpijylwyaadeni7xemq734.jpg"/>
After a search on the internet to understand, originally because when installing SQL Server , because the use of the above tutorial, and that tutorial in the installation step is such a choice of--650) this.width=650; "Src=" http ://s3.51cto.com/wyfs02/m00/53/ce/wkiom1rwgiysk-lzaae65wtafe8895.jpg "title=" 1-2.jpg "alt=" Wkiom1rwgiysk-lzaae65wtafe8895.jpg "/>
The default is Windows authentication mode, so it fails to connect to the database using SQL Server authentication mode, and the solution is simple, and I found it here http://www.czitc.com/service/sqlproc3.htm , which is the second error it says ( It is important to note that we are using SQL Server database, open SQL Server 2008Management Studio, this is just a client, In accordance with the modification method of this URL, restart the program should be to "My Computer" right-click "Management" in the "services" in the "service" to find MSSQLSERVER, restart it, this is the database )
That's the problem, it's settled.
Working with Database software
And look at the Connect to server page
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/53/CC/wKioL1RwgSfgmCaWAADsCk289VY942.jpg "title=" 1-3- Connect to Server page. jpg "alt=" wkiol1rwgsfgmcawaadsck289vy942.jpg "/>
Finally connected to the local database, the following is a few simple operation with the mouse
Create and delete logged-in users
This requires that the database be connected to Windows authentication before it is created
Create:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/53/CE/wKiom1RwgM3xgGynAAOK0A_QD2A552.gif "title=" 1-4 Create a new user. gif "alt=" Wkiom1rwgm3xggynaaok0a_qd2a552.gif "/>
Delete:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/53/CC/wKioL1RwgWnyFG_KAAK3NmRDgss377.gif "title=" 1-5-delete new user. gif "alt=" wkiol1rwgwnyfg_kaak3nmrdgss377.gif "/> the shortcut key to open this Object Explorer Details is F7
New and deleted databases
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/53/CE/wKiom1RwgQmRt0v9AAW7d8PL_fY397.gif "title=" 1-6- New and deleted databases. gif "alt=" Wkiom1rwgqmrt0v9aaw7d8pl_fy397.gif "/>
Note that if the database you want to delete is already connected, you need to check the close an existing connection this check box
Attaching and detaching a database
Attaching is adding the database file to the server instance, simply by adding the database file to the database management software
Detach is to remove the database file and its corresponding transaction log file from the database management software
Refer to--http://msdn.microsoft.com/zh-cn/library/ms190794.aspx
Separation:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/53/CC/wKioL1Rwgazyvd-oAAGn7CkrnyA630.gif "title=" 1-7- Detach the database. gif "alt=" Wkiol1rwgazyvd-oaagn7ckrnya630.gif "/>
Additional:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/53/CE/wKiom1RwgUXQi22BAAKGaoojDiI413.gif "title=" 1-8- Attach the database. gif "alt=" Wkiom1rwguxqi22baakgaoojdii413.gif "/>
The path that is stored by the new database file is specified when the database management software is installed
New and deleted tables
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/53/CE/wKiom1RwgWSibLaZAAdvpYZCtKc247.gif "title=" 1-9- Create new and delete tables. gif "alt=" Wkiom1rwgwsiblazaadvpyzctkc247.gif "/>
Properties, data, and the contents of the primary key are also added to the table.
As for the setting of attributes in the table, there are many property variables, what is the use, from the Internet a search can be, such as here--http://www.w3school.com.cn/sql/sql_datatypes.asp, this site is good, there are . CHM format Help Document
Written in more detail, because I think, for the novice, any veteran think that is not a problem, there may be problems, such as when inserting attributes in the table, select the data type of the property, such as varchar (max), to be ashamed, at first I did not have one into the inside Max is let fill in the number, it represents the data type occupies the byte, based on this, I so record my own notes
if not, it is in the Windows8.1 Professional Edition system Environment of SQL Server in the official version of the operation, If there are errors, please note.
This article is from the "own Learning record" blog, please be sure to keep this source http://itshequkeng.blog.51cto.com/9378041/1581420
Beginner SQL Server 2008 Database _1