Showing posts with label MS SQL. Show all posts
Showing posts with label MS SQL. Show all posts

Monday, October 19, 2009

Some Awareness regarding SQL

Hi,
Here are some basic points regarding the SQL.
SQL : Structured Query Lang, which is developed by IBM in 1970's.
It has 4 sub lang.
1) DDL(Data definition lang) : Meta data, like size, type, : create, alter, drop.
2) DML(Data Manipulation lang) select, insert, update, delete.
3) TCL(Transaction control lang) (commit, rollback, save point).
4) DCL(Data Control lang).
RDBMS
RDBMS : It is conceptual accepts , specifies how the data to be persisted... & some rules how to arrange the data so that the retrieval/insertion/processing the logic will be easy.
RDBMS : is the root & we can have so many implementations for RDBMS like Oracle, SQL Server, Sybase....

In General all the RDBMS will follow 4 properties which are called as ACID.
ACID :
1) Atomicity (bunch of statements should execute at a time or rollback)
2) Consistency( All the time the data should maintain some consistency)
3) Isolation( one transaction should not effect the other transaction )
4) Durability. ( No data loss...Achieved using the locks)

MS SQL Server : Bulk Insert

Two ways for bulk insert in MS SQL Server:
1) select au_fname +','+ au_lname as autName into tempAuth from authors
Here tempAuth table should not exists in the database. so in the execution time the table will be created with the constraints of the parent table authors.
2) insert into tempAutho select au_fname +','+ au_lname as autName from authors
Here we are supposed have the table already exist with the same column constraints...