Skip to main content

Posts

Showing posts from June, 2016

SQLSERVER 4: Creating Tables in SQL Server

The basic building block of storing data in SQL Server Database is a “Table” aka “Relation”. It’s a collection of rows and columns grouped together. Ø   Rows in a table are aka Tuples, Records. Ø   Columns in a table are aka Fields, Attributes, Columns. The following figure clearly explains the terminology: We can see that the above figure represents a Relation / Table named “DEPT” and it has got fields like “Deptno”, “Dname” etc. The following command is used to create a table: Create Table Dept (      Deptno numeric ( 10 ),      Dname varchar ( 100 ),      Loc varchar ( 100 ) ) We are creating a table with 3 columns. And two columns have “varchar” datatype and Deptno has got “numeric” datatype. DataType means what kind of Data we can store in that field. Numeric as name suggests can store numbers and Varchar can store alphanumeric. We will have more on DataTypes in the coming posts for different data types in SQL Server. So we have

SQLSERVER 3: Create a User Database in SQL Server

Creating User Defined Databases in SQL Server. As a user we can create a User Defined Database in SQL Server. This database can store tables, views, stored procedures, functions etc. Every database has got two files: a.      MDF File This is the main data file in which data is stored. b.      LDF File LDF primarily stores all the logs. Logs are nothing but recording of every activity going in the database like inserting, deleting, updating etc. for the purpose of backup and retrieval. The following command can be used to create a Database in SQL Server Management Studio. USE [master] GO CREATE DATABASE Test        On Primary     (               NAME = N'Test' , FILENAME = N'C:\Temp\Test.mdf' ,               SIZE = 167872 KB , MAXSIZE = UNLIMITED , FILEGROWTH = 16384 KB        )        LOG ON     (               NAME = N'Test_Log' , FILENAME = N'C:\Temp\Test_Log.ldf' ,        

SQLSERVER 2: System Databases

System Databases SQL Server comes with certain System Databases, that get installed by default. All the System Databases has some specific purpose and they primarily maintain META Data i.e. Data about Data.   a.       Master This is a System Database that is primarily used to store information about the user data. For e.g. if we create a table, then information about its primary key, how many columns, data types etc. is maintained in this database. b.      Model This is a template database that is used whenever we create a new Database. This will help in laying the basic structure of our new database. c.       TempDB This is also known as Temporary Database. SQL Server uses TempDB for storing temporary data while doing different operations. d.      MSDB The msdb database is used by SQL Server Agent for scheduling alerts and jobs. Will be posting more stuff about SQL Server. Stay tuned. !!!!!

SQLSERVER 1: What is SQL Server?

SQLSERVER_1: What is SQL Server? SQL Server is a RDBMS (Relational Database Management System) from Microsoft. It supports T-Structured Query Language (Transact -SQL) and PL/SQL. Recently Microsoft has made lot of improvements in this product by introducing Business Intelligence, Reporting Services, etc. SQL Server primarily constitutes: a. T-SQL and PL/SQL b. Reporting Services. c. SSIS - SQL Server Integration Services. d. SSAS- SQL Server Analysis Services. Microsoft SQL Server is one of the RDBMS in the market besides Oracle, MySQL, PostGRE etc. Current Version of SQL Server is 2016. And it comes in different Editions.

SQL Server Tutorial Posts.

On popular requests from my dear students, I am going to post stuff about Databases and that too on SQL Server. All my next posts will focus on the basics of the SQL Server, its working, SQL and PL/SQL etc. Enjoy all the posts and in case you want to have posts on specific topics, please share at dhandrohit@gmail.com