SQL
SQL
--Q.What is data?
--Collection of meaniful information.
--OR
--Collection record information.
--Q.what is table ?
--it is collection of rows and columns.
--In SQL
--Blue color indicates system defined keywords
--for ex
create, use, insert etc
--Pink color indicates system defined functions
--for ex
sum,min,max etc
--Data types
--Type of data/value of an object can hold is known as data type.
--A].Numeric data type
--1.BIT
--it stores value 0 or 1
--2.TINYINT
--It will store the value ranging from 0 to 255
--3.SMALLINT
--it will store value ranging -32768 to 32767
--4.Decimal
--an exact fixed point number
--5. INT
--it stores an integer value i.e. ranging from -2147483648 to 2147483647
--3.nchar
--It is static memory allocation and it can store 4000 charecters (1 char it will
occupy 2bytes)
declare @value nchar(4000) = 'AMAR'
print @value
print datalength(@value)
print len(@value)
--4.nvarchar
--It is dynamic memory allocation and it can store 4000 charecters (1 char it will
occupy 2bytes).
--3.Datetime
--It will allow you to insert date and time together.
--YYYY/MM/DD HH:MM AM/PM
-----------------------------------------------------------
Class 2
--Create
--This Is DDL SQL statement and used to create database and Table.
--In SQL if you want to terminate SQL statement then use ; at the end of statement.
--SELECT
--Select statement is used to select the data which you have written
--This is DML statement and used to fetch the records from table.
select 88888
--METHOD-II
--We dont have restrictions to insert the data as per column sequence defined in
table.
--While inserting the data we have to mention column names in insert statement.
insert into FirstTable (FID,FirstName) values (2,'Amit')