Monday 18 November 2013

Sql Programing

Programming in SQL Server




Program 1.

 

begin 
 
print ' welcome to SQL Programming ‘
print ' SQL Server ‘ 

 
end


Program 2.

 

begin

declare @a int
declare @b int
declare @c int

set @a=67
set @b = 99
set @c=@a+@b

print @a
print @b
print@c

 print ' first program '

end


Program 3.

 

declare

@p int,@n decimal(5,2),@r decimal(5,2), @si decimal(7,2)

begin

set @p=10000
set @n=15
set @r=7.5
set @si=(@p*@n*@r)/100

print ' simple interest : ' + convert(varchar,@si)

end


 Program 4.

 

declare

@a int,@b int,@c int

begin

set @a=50
set @b=120
set @c=35

if @a>@b and @a>@c

print ' a is big'

else if @b>@c

print ' b is big'

else

print ' c is big'

end

 Program 5.

 

declare

@a int

begin

set @a=1

while (@a<=5)

begin

print @a

set @a=@a+1

end

 


Wednesday 13 November 2013

Palindrome


Palindrome Problem


A palindrome is a word that reads the same both forwards and backwards.
Examples: anna, nitalarbralatin, amanaplanacanalpanama.

Program -

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{char a[20],b[20];
cout<<"enter the string"<<endl;
gets(a);
strcpy(b,a);
strrev(b);
if(strcmpi(a,b)==0)
cout<<"palindrome"<<endl;
else
cout<<"nay"<<endl;
getch();
}

Tuesday 12 November 2013

SQL Select Command

SQL STATEMENT


SELECT Statement

The SELECT statement is used to select data from a database.
The result is stored in a result table, called the result-set.

 Syntax -

SELECT column_name(s)
FROM table_name
and
SELECT * FROM table_name
 Note: SQL is not case sensitive. SELECT is the same as select.

 SELECT DISTINCT Statement


In a table, some of the columns may contain duplicate values. This is not a problem, however, sometimes you will want to list only the different (distinct) values in a table.
The DISTINCT keyword can be used to return only distinct (different) values.

 Syntax -

SELECT DISTINCT column_name(s)
FROM table_name

The WHERE Clause

The WHERE clause is used to extract only those records that fulfill a specified criterion.

Syntax -

SELECT column_name(s)
FROM table_name
WHERE column_name operator value

The ORDER BY Keyword

The ORDER BY keyword is used to sort the result-set by a specified column.
The ORDER BY keyword sort the records in ascending order by default.
If you want to sort the records in a descending order, you can use the DESC keyword.

 Syntax -

SELECT column_name(s)
FROM table_name
ORDER BY column_name(s) ASC|DESC



Artificial Intelligence (AI)

  Artificial Intelligence (AI) The Power and Potential of Artificial Intelligence Artificial Intelligence (AI) is revolutionizing the world ...