SQL Serever Learning 15--Advanced

Source: Internet
Author: User

Special note: In sqlserver2014, case insensitive, that is, SQL is case insensitive

Database Model 3 classes:
    1. Hierarchical model
    2. Mesh model
    3. Relational model
3 Types of relational database languages:
    1. DDL Data Definition Language
      1. Create (creates a library or database object), ALTER, DROP
    2. DML Data Manipulation language
      1. SELECT (retrieve table or view), UPDATE, INSERT, DELETE
    3. DCL Data Control Language
      1. Grant (grant permission), REVOKE (revoke permission), deny (Deny permission, and prohibit inherit permission from other roles)
System Database 4:
    1. master database
      1. Log all system information, such as login account, System configuration
    2. Model database
      1. All database templates, modifications to the model database will be applied to all future databases
    3. msdb database
    4. tempdb database

Template browser window

SSMS provides a large number of script templates that contain parameters that are supplied by the user, using this parameter to enter only one name at a time, and then automatically copy the changed name to all the necessary locations in the script.

Create a database using a template

To create database from the Template browser window, drag to the query window, automatically creating the code

Select query = = To specify the value of the template parameter,

Replace the original value in the open window and change to "Sales management 2" to determine

Then analyze it first, then click the Execute button to

View the online Help documentation

Here's the help document, the amount of data is very large

Select sqlserver2014 developer Reference, installation, Microsoft SQL Server Language Reference, click Update

Manipulate database files (add and revise)

Add a log file for sales Management 2

View database files First

modifying database files

Write Execute SQL, modify the file location of the database, size

ALTER DATABASE Sales Management 2MODIFY FILE (name= sales Management 2,filename= ' e:/data/sales Management 2.mdf ', SIZE=12MB) GO

Delete a database file

ALTER DATABASE Sales Management 2REMOVE FILE Sales Management 2_2

Note: The primary database file and the primary log file are not deleted

Additional data types supported by sqlserver2014

Data Integrity 4 Types:

Entity integrity (rows, data is not duplicated)

Domain integrity (columns, satisfying for specific constraints)

Referential integrity (foreign KEY constraints)

User-defined integrity (custom constraints, triggers)

To set the force Modification data table

SQLSERVER2014 installation, the default is not forced to modify the data table structure, if you want to modify, set the method as follows:

Tool = = "option = =" designer = = "Table Designer and Database Designer = =" Block save ... Check to remove, OK

SQL for creating views (can be created using SSMS)

A view of CREATE view

As SQL statements

GO

Like what:

Use Sales Management gocreate view Asselect buyer name from buyer table Go

  

SQL Serever Learning 15--Advanced

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.