Start of basic SQL Server knowledge

Source: Internet
Author: User

1. After the database is successfully installed, it contains four default databases: The Master saves the system information, the model database template, the temporary tempdb information, and the MSDB plan alarm and operation.

Industry. Add the resource database. The read-only database contains all objects in the system.
2. databases include data tables, views, stored procedures, extended stored procedures, cursors, triggers, rules, default values, and constraints.
3. There must be two operating system files: 1. data file record tables, indexes, and other related data information; 2. log file record recovery of all transaction information in the database

Information
4. SQL Server 2005 contains three data files: master data files, other data files, and transaction log files.
5. Detailed syntax for Data creation
Create Database Test
-- A database is a file group, including data files and log files.
-- Data File
On
(
Name = test_data,/* logical name of the file */
Filename = 'e:/test_data.mdf ',
Size = 4,/* default unit: MB
Maxsize = 10,
Filegrowth = 10%/* default file growth percentage

)
-- Log File
Log On
(
Name = test_log,
Filename = 'e:/test_log.mdf ',
Size = 1,
Maxsize = 6,
Filegrowth = 1
)

====
-- View the table structure
Use byfmiles
Go
Exec sp_help byfimageinfo
Go
-- View table Constraints
Use db_03
Go
Exec sp_helpconstraint tb_19
Go
===

Next, let's take a look at the example of creating a database:

Create Database TS
On
(
Name = ts,
Filename = 'G: \ BS \ ts. MDF ',
Size = 5, // 5 MB
Maxsize = 30, // maximum 30 mb
Filegrowth = 5%
)
Log On
(
Name = ts_log,
Filename = 'G: \ BS \ ts_log.ldf ',
Size = 2 MB,
Maxsize = 25 MB,
Filegrowth = 5 MB
)
Go
Index setting for improving SQL Server database performance
Next, let's start learning indexes.

Related Article

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.