0% found this document useful (0 votes)
3 views

DataTypes

Uploaded by

ahmadzai.199a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

DataTypes

Uploaded by

ahmadzai.199a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1: Byte (Store whole number) Size:

255
2: Integer (Store whole number)Size:
32767
3: Long (Store whole number)Size:
2,147,483,648
4: Single: (Store floating point number) Size:
4bytes
5: Double(Store floating point number)Size:
8bytes
6: DateTime
7: Currency
8: Yesno
9: Autoincrement

========================================
Insert into
insert into tableName(Field1,Field2,Field3)
values(Field1value,Field2value)

========================================
Update
update tableName
set FieldName=UpdateValue
where FieldtoUpdate=value
========================================
Delete
Delete * from tableName to delete all records
delete * from tableName where ID=Number to delete spacific records
========================================
Alter
to add, delete & modifiy the records
to add: alter table tableName
add ColumnName datatype
to Delete:
alter table TableName
drop Column ColumnName
to Modifiy:
alter table TableName
alter column ColumnName Datatype
========================================
Drop
to drop a table means to delete it
Drop table tableName
========================================
Select
to select a record:
select * from tableName;
select * from TableName where FieldName=Value
to select a field:
select Column1,Column2,Column3 from tableName;
========================================
Sorting
Ascending
select * from tableName order by ColumnName;
Descending
select * from TableName order by ColumnName Desc;
========================================
Aliases
Select SName as StdName, FName as StdF/Name,
StdClasses as Class from emp;
========================================
Constraints
It's used to specify rules for data in a table.
1: Not Null
not null is a column which we can not leave it null.
create table Student(
StdID int Not Null,
StdName varchar(255),
StdClass varchar (255),
StdAge int,
Phone varchar (255)
)
2: Unique Key
is a rule in which you shouldn't dublicate the data.
create table Student(
StdID int unique,
StdName varchar(255),
StdClass varchar (255),
StdAge int,
Phone varchar (255)
)
3: Primary key
you can create when you already created the table and you want
to add the primary key.
alter table student
add primary key (StdID);

========================================
Operators
1: Arithmethic operators
2: Comparion operators
3: Logical Operators

a)Arithmethic Operators
1: Addition +
2: Subtraction -
3: Multifly *
4: Divide /
select empname, salary + Overtime, from emptable

b) Comparion operators
>
<
>=
<=
<>
c)Logical Operators
and
or

You might also like