300x250 AD TOP

helooo
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Tagged under:

Introduction about Sql Server and Versions



Microsoft SQL Server is a relational database management system developed by Microsoft.
As a database, it is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet). 
Versions:
SQL Server 2005: 
SQL Server 2005 (formerly codenamed "Yukon") released in October 2005. It included native support for managing XML data, in addition to relational data. 

SQL Server 2008:
SQL Server 2008 (formerly codenamed "Katmai") was released on August 6, 2008 and aims to make data management self-tuning, self organizing, and self maintaining with the development of SQL Server Always On technologies, to provide near-zero downtime.
 SQL Server 2008 also includes support for structured and semi-structured data, including digital media formats for pictures, audio, video and other multimedia data.

SQL Server 2008 R2:
SQL Server 2008 R2 (10.50.1600.1, formerly codenamed "Kilimanjaro") was announced at TechEd 2009, and was released to manufacturing on April 21, 2010.
SQL Server 2008 R2 adds certain features to SQL Server 2008 including a master data management system branded as Master Data Services, a central management of master data entities and hierarchies

SQL Server 2012:
At the 2011 Professional Association for SQL Server (PASS) summit on October 11, Microsoft announced that the next major version of SQL Server (codenamed "Denali"), would be SQL Server 2012.
 It was released to manufacturing on March 6, 2012.SQL Server 2012 Service Pack 1 was released to manufacturing on November 9, 2012.
It was announced to be the last version to natively support OLE DB and instead to prefer ODBC for native connectivity.

SQL Server 2014:
SQL Server 2014 is still in Community Technology Preview stage. As of November, 2013 there have been two such revisions, CTP1 and CTP2. 
SQL Server 2014 will provide a new in-memory capability for tables that can fit entirely in memory (also known as Hekaton).
Development Tools:
1.SQLCMD:
SQLCMD is a command line application that comes with Microsoft SQL Server, and exposes the management features of SQL Server.
It allows SQL queries to be written and executed from the command prompt. It can also act as a scripting language to create and run a set of SQL statements as a script.
Such scripts are stored as a .sql file, and are used either for management of databases or to create the database schema during the deployment of a database.
2. SQL Server Management Studio:
SQL Server Management Studio is a GUI tool included with SQL Server 2005 and later for configuring, managing, and administering all components within Microsoft SQL Server.
The tool includes both script editors and graphical tools that work with objects and features of the server.
SQL Server Management Studio replaces Enterprise Manager as the primary management interface for Microsoft SQL Server since SQL Server 2005.
3. Business Intelligence Development Studio:
Business Intelligence Development Studio (BIDS) is the IDE from Microsoft used for developing data analysis and Business Intelligence solutions utilizing the Microsoft SQL Server Analysis Services, Reporting Services and Integration Services.
It is based on the Microsoft Visual Studio development environment but is customized with the SQL Server services-specific extensions and project types, including tools, controls and projects for reports (using Reporting Services), Cubes and data mining structures (using Analysis Services).

Tagged under:

RDBMS Concepts


RDBMS
RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
Table:
The data in RDBMS is stored in database objects called tables. The table is a collection of related data entries and it consists of columns and rows.
Remember, a table is the most common and simplest form of data storage in a relational database. Following is the example of a CUSTOMERS table:
| ID | NAME           | AGE |      ADDRESS      | SALARY   |
|  1 | Venkatesh   |  24 |        Banglore      |  2000.00 |
|  2 | Khilan         |  25 |        Delhi           |  1500.00 |
|  3 | kaushik       |  23 |        Kota            |  2000.00 |
|  4 | Chaitali      |  25 |        Mumbai        |  6500.00 |
|  5 | Hardik        |  27 |       Bhopal          |  8500.00 |
|  6 | Komal         |  22 |       MP               |  4500.00 |
|  7 | Muffy          |  24 |      Indore         | 10000.00 |

Field:
Every table is broken up into smaller entities called fields. The fields in the CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.
A field is a column in a table that is designed to maintain specific information about every record in the table.
record/row:
A record, also called a row of data, is each individual entry that exists in a table. For example there are 7 records in the above CUSTOMERS table. Following is a single row of data or record in the CUSTOMERS table:
|  1 | Venkatesh   |  32 | Banglore |  2000.00 |
A record is a horizontal entity in a table.
 column:
A column is a vertical entity in a table that contains all information associated with a specific field in a table.
For example, a column in the CUSTOMERS table is ADDRESS, which represents location description and
| ADDRESS   |
| Bangalore|
| Delhi     |
| Kota      |
| Mumbai    |
| Bhopal    |
| MP        |
| Indore    |

NULL value:
A NULL value in a table is a value in a field that appears to be blank, which means a field with a NULL value is a field with no value.
It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation.




Tagged under:

Sql All DataTypes



SQL data type is an attribute that specifies type of data of any object. Each column, variable and expression has related data type in SQL.
You would use these data types while creating your tables. You would choose a particular data type for a table column based on your requirement.
SQL Server offers six categories of data types for your use:
Exact Numeric Data Types:
DATA TYPE
FROM
TO
Bigint
-9,223,372,036,854,775,808
9,223,372,036,854,775,807
Int
-2,147,483,648
2,147,483,647
Smallint
-32,768
32,767
Tinyint
0
255
bit
0
1
decimal
-10^38 +1
10^38 -1
numeric
-10^38 +1
10^38 -1
money
-922,337,203,685,477.5808
+922,337,203,685,477.5807
smallmoney
-214,748.3648
+214,748.3647
Approximate Numeric Data Types:
DATA TYPE
FROM
TO
float
-1.79E + 308
1.79E + 308
real
-3.40E + 38
3.40E + 38
Date and Time Data Types:
DATA TYPE
FROM
TO
datetime
Jan 1, 1753
Dec 31, 9999
smalldatetime
Jan 1, 1900
Jun 6, 2079
date
Stores a date like June 30, 1991
time
Stores a time of day like 12:30 P.M.
Note: Here, datetime has 3.33 milliseconds accuracy where as smalldatetime has 1 minute accuracy.
Character Strings Data Types:
DATA TYPE
FROM
TO
char
char
Maximum length of 8,000 characters.( Fixed length non-Unicode characters)
varchar
varchar
Maximum of 8,000 characters.(Variable-length non-Unicode data).
varchar(max)
varchar(max)
Maximum length of 231characters, Variable-length non-Unicode data (SQL Server 2005 only).
text
text
Variable-length non-Unicode data with a maximum length of 2,147,483,647 characters.
Unicode Character Strings Data Types:
DATA TYPE
Description
nchar
Maximum length of 4,000 characters.( Fixed length Unicode)
nvarchar
Maximum length of 4,000 characters.(Variable length Unicode)
nvarchar(max)
Maximum length of 231characters (SQL Server 2005 only).( Variable length Unicode)
ntext
Maximum length of 1,073,741,823 characters. ( Variable length Unicode )
Binary Data Types:
DATA TYPE
Description
binary
Maximum length of 8,000 bytes(Fixed-length binary data )
varbinary
Maximum length of 8,000 bytes.(Variable length binary data)
varbinary(max)
Maximum length of 231 bytes (SQL Server 2005 only). ( Variable length Binary data)
image
Maximum length of 2,147,483,647 bytes. ( Variable length Binary Data)
Misc Data Types:
DATA TYPE
Description
sql_variant
Stores values of various SQL Server-supported data types, except text, ntext, and timestamp.
timestamp
Stores a database-wide unique number that gets updated every time a row gets updated
uniqueidentifier
Stores a globally unique identifier (GUID)
xml
Stores XML data. You can store xml instances in a column or a variable (SQL Server 2005 only).
cursor
Reference to a cursor object
table
Stores a result set for later processing




Tagged under:

Explination on Operators In Sql



An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations.
Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement.
  • Arithmetic operators
  • Comparison operators
  • Logical operators
  • Operators used to negate conditions
SQL Arithmetic Operators:
Assume variable a holds 10 and variable b holds 20, then:
Operator
Description
Example
+
Addition - Adds values on either side of the operator
a + b will give 30
-
Subtraction - Subtracts right hand operand from left hand operand
a - b will give -10
*
Multiplication - Multiplies values on either side of the operator
a * b will give 200
/
Division - Divides left hand operand by right hand operand
b / a will give 2
%
Modulus - Divides left hand operand by right hand operand and returns remainder
b % a will give 0
SQL Comparison Operators:
Assume variable a holds 10 and variable b holds 20, then:
Operator
Description
Example
=
Checks if the values of two operands are equal or not, if yes then condition becomes true.
(a = b) is not true.
!=
Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
(a != b) is true.
<> 
Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
(a <> b) is true.
> 
Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
(a > b) is not true.
< 
Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
(a < b) is true.
>=
Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.
(a >= b) is not true.
<=
Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
(a <= b) is true.
!<
Checks if the value of left operand is not less than the value of right operand, if yes then condition becomes true.
(a !< b) is false.
!>
Checks if the value of left operand is not greater than the value of right operand, if yes then condition becomes true.
(a !> b) is true.
SQL Logical Operators:
Here is a list of all the logical operators available in SQL.


Operator
Description
ALL
The ALL operator is used to compare a value to all values in another value set.
AND
The AND operator allows the existence of multiple conditions in an SQL statement's WHERE clause.
ANY
The ANY operator is used to compare a value to any applicable value in the list according to the condition.
BETWEEN
The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value.
EXISTS
The EXISTS operator is used to search for the presence of a row in a specified table that meets certain criteria.
IN
The IN operator is used to compare a value to a list of literal values that have been specified.
LIKE
The LIKE operator is used to compare a value to similar values using wildcard operators.
NOT
The NOT operator reverses the meaning of the logical operator with which it is used. Eg: NOT EXISTS, NOT BETWEEN, NOT IN, etc. This is a negate operator.
OR
The OR operator is used to combine multiple conditions in an SQL statement's WHERE clause.
IS NULL
The NULL operator is used to compare a value with a NULL value.
UNIQUE
The UNIQUE operator searches every row of a specified table for uniqueness (no duplicates).