#1 Getting Started with SQL Notes (1)

Source: Internet
Author: User
Tags create directory filegroup

  Today's notes are mainly about the common sense of the database, and the creation of the database. The method to create the database is similar, so master this, create a database is ok (normal use enough). Of course, it is relatively rare to create a database in real work. The database is designed using the Build Library tool (Eg:powerdesign).

---2014.07.29

Commonly used databases:

Ms:sqlserver2008->.net
IBM:DB2 tobacco.
Oracle: Oracle Bank, securities ...
Non-commercial:mysql->ibm,oracle-> small site
Access,sysbase


SQL: Structured Query Language ! T-SQL Sql-plus

Classification of SQL languages:
1.DDL: Data definition language, Create,drop, delete ....
2.DQL: Data Query Language Select
3.DCL: Data Control Language Rights management ....
4.DML: Data Manipulation language Insert,delete, update

The history of database development:
1. Ropes Notes
2. Mind
3. disk files
4. Relational database->sql Server
5. Relational-Object Database->oracle

Database db: not just a table! + Management, views, stored procedures, triggers .....
  DBMS: database management system:
  DBA: database administrator
  DBO: database owner
  Redundancy : more data out!
  inconsistency: redundancy results in inconsistent data!

Classification of database files:
1. Physical File Partitioning
1.1 Data files (primarily for data information)
1.1.1 Main data files: *. MDF =1
1.1.2 times to data file: *. NDF >=0
1.2 Log file LDF >=1


2. Logical structure to divide
2.1 System Database
2.1.1 Master: Core components->sql normal operation
2.1.2 Model: Template->19 File
2.1.3 msdb: Alert warning
2.1.4 Tempdb: Staging Database-"intermediate data"
2.2 User-defined database



Ms->northwind (the database used for learning, can be downloaded on the internet to see)

Filegroup: = "Data file
1. Main filegroups:->mdf
2. User-defined filegroup:->NDF

Recite the code (a person who has no foundation, just recite it or understand it.) Personal recommendation Understanding Good)

--Jump Core Library UseMasterGo--Batch processing--Create directory d:\11.30execxp_cmdshell'MD d:\11.30'--to use this, to configure SQL configuration, configure the method belowGo--determine if the database exists and delete it if it exists! if db_id('db_1130') is  not NULLDrop Databasedb_1130GoCreate Databasedb_1130 on Primary(Name='YL',--Logical NameFileName='D:\11.30\yl.mdf', size=3, MaxSize=5, FileGrowth= -%)Log  on(Name='Yllog',--Logical NameFileName='D:\11.30\yl.ldf', size=3, MaxSize=5, FileGrowth= -%)Go

Configuration:

Login sql2008--"Right-click Server--" Select - -"Open dropdown box-" SELECT "Peripheral Application Configuration"-Xpcmdshellenable select true; Ok

PS: Picture upload is too troublesome, forgive me. Do not understand can m me.

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.