Some of the paper is shabby, some vague. Each stroke can be sketched, every trace, seems to record across the millennium Wanzai miss, that sentiment stretches without thread, who can xiao that part of lonely sorrow around the finger soft. ---SQL can I uncover your veil of mystery.
You think I'm talking about a goddess who can only appear in a dream, elusive? Haha, actually I want to talk about is that has been heard but never know what is the mysterious database, it also has a foreign name called SQL Server.
Speaking of the database, we all know that the database is one of the knowledge that every development God must master, as the name implies, the database is the existence that we use to store the data. Then why do we use the database? Because it has the following four benefits!
1. Can store large amounts of data
2. Consistency and completeness of data can be ensured
3. Can meet the sharing and security requirements of the application
4. Convenient and intelligent analysis to generate new and useful information
Now that the database is so useful to us, let's see how we can use the database!
(I have just learned the database, so I just share with you some ideas about the database.)
The following are some of our common databases :
Oracle DB2 SQL Server MySQL sqllite Visual FoxPro access
We can also briefly understand what the DBMS and DBS are.
Dbms:database ManageMent System: Database management Systems
Dbs:database System Database
Relationship: DBS contains DBMS
First of all, we have to use the installation first, we generally use the SQL Server 2008r2 version
After installation, if we double-click to open the database then you will find that we can not login, so we have a step to complete before use, that is, the service must be started . There are three ways to start a service:
Method one: To "My Computer" → Right-click "Services" →sql Server (MSSQLServer)
Method Two: Open the Start menu → run →services.msc Enter to open the service window, follow the same procedure
Method Three: Press and hold the "Win+r" on the keyboard to open the Command Prompt window, enter the →services.msc carriage return to open the service window, follow the same procedure
When we open the service, we'll be able to log in.
There are two ways to log in to SQL Server:
Windows authentication
SQL Server Authentication: The SA room password is empty by default
After landing we can see 5 kinds of system database
Resource database: Role: Users create a new database school, then some information is automatically mapped from resource to school
Master database: Saves all database information and, once corrupted, the entire database software will not run.
Model: Template Database
Tempdb: Staging database, saving temporary data
MSDB: Agents, business scheduling, alert jobs, etc.
Next I share with you several common simple operations to detach, attach, back up, and restore the database.
Detach Database:
We are not able to replicate when we need to transfer data in a normal state. So we're going to make it through separation.
Detach method: Right-click on the database file, select Task---> Detach----> Open Detach Database "Click OK" on the popup shortcut menu.
Additional databases:
When we detach the database, the database is not displayed in our manager, and we want it to be displayed so that it can be implemented with additional actions.
Right-click on the database file, Pop-up shortcut menu, select Attach Find file location.
Backup database (this is very important!!!) )
Backup data is very important, we want to prevent our data loss or some other reasons cause the loss of the database, we have to timely backup, right-click on the database file, Pop-up shortcut menu select Task---> Backup----> will open the Backup database "click OK".
We'd better name the backup file with the suffix name of. bak
Restore the database:
When we delete some databases but we need to use them, we can restore the database to achieve, but the premise is that there is a backup!! The restore operation is also very simple, we can point the database, choose to restore the database, when the dialog box appears, we can enter the database name, select the source device, locate the backup file location, tick .
Shrinking a Database
We need to reduce the amount of space allocated to database files and transaction log files when we use the database for a period of time because of the frequent data deduplication that causes too much free space in the database. So at this point we need to "shrink" the operation to reduce the waste of space.
Automatically shrink and manually shrink the database. We then shrink through the options of the properties.
To delete a database:
We must reconfirm before deleting!! If you are sure you want to delete, you must remember to back up the data!! Click the right button to delete the database and delete it.
Well, the simple understanding of the database we finished, this is just a simple database operation, there is a long way to go, behind the operation I will also discuss with you to share, I hope we can work together to refuel!
If a firework cloud only gives you one person