Tuesday, June 18, 2013

Most common and basic SQL Queries of DBMS

Leave a Comment Follow us on twitter
SQL Queries as you already know from previous post is the essential of Database Management System (DBMS). In this post we are going to learn some of the very basic SQL Queries that are commonly used. Let’s see these SQL Queries one by one.


Most Commonly used SQL Queries



1. Create a Table

To create table the command used is create table. Syntax is as follows:

create table table-name(column1 datatype, column2 datatype, column3 datatype….,columnn datatype);

E.g.

create table employees(name varchar2(25), employee_id number(5), salary number(10));

2. Insert values into table

Inserting values into a table is done by using insert command. Syntax is as follows:

insert into table-name values(“value1”,value2,value3);

E.g.

insert into employees values(“John”,12545,25000);

Here the name is taken into inverted commas as except number, we use all the values into inverted commas.

3. Display Table

Display a table is quite easy. To display a table along with its all columns, select command is used. Syntax is as follows:

select * from table-name;

E.g.

select * from employees;

Running the very above command will display the whole table, that’s why * is used. To display any specific column or multiple specific columns, * is replaced by column name.

For example: select name,salary from employees;

4. Describe Table

To show the names of column along with their datatypes the command we use is desc or describe. It will show the complete description of your table. Syntax is as follows:

desc table-name; or describe table-name;

E.g.

desc employees; or describe employees;

These are some of the very common and basic SQL Queries generally used. I hope that you will be now able to understand the SQL Queries without any difficulty. If you want to practice these SQL Commands you can download Oracle 11g which is the latest edition from Oracle directly from their website. In the next post we will discuss about the constraints used in SQL Queries.
READ MORE...

Wednesday, June 12, 2013

SQL Queries in DBMS: A beginner’s guide

Leave a Comment Follow us on twitter
SQL Queries are very important part of Database Management System (DBMS). Structured Query Language is a language which led user to interact with Database Management System (DBMS). To handle and manage the database one should know about these SQL Queries. Here we are going to discuss some of the very basic and important SQL Queries which are going to help thought your life whether you are going to be a Database Administrator (DBA) or pursue a career in Database etc.

Data types used in Structured Query Language (SQL)




Most commonly the data types used in SQL are char, varchar, varchar2, number, date and long. Let’s see each of them one by one.
 
  • char: As the name implies char represents character string of maximum 255 characters. However user can specify its own limit for the variable. Syntax is variable_name char(number of characters).

E.g. country char(20)

This states that user can enter any country name having maximum of 20 characters. If the name of country contains less than 20 characters then the rest of the size will be filled with the spaces.

  • varchar: This data type is very similar to char and perform the same function as of char data type.  The difference is that varchar can take the character string of maximum 4000 characters. Unlike the char data type, varchar doesn’t pad inserted value with spaces. Syntax is variable_name varchar(number of characters).

  • varchar2: varchar2 is the advance version of varchar. There is no difference between the two, however experts says using varchar2 is better than varchar. I don’t know what the reason is.

  • number: This data type is used to store the numbers. Syntax is variable_name number(size),  where size is the maximum length of data.

E.g. addition number(4);
  • long: long data type accepts the character string maximum of 2 Giga Bytes. In normal practice we don’t use long data type.

So, these are the data types that are mostly used while performing the SQL Queries.
READ MORE...

Saturday, June 08, 2013

Guaranteed asked Java Interview Questions

Leave a Comment Follow us on twitter

Java Interview Questions


These are guaranteed Java Interview Questions that are mostly asked by the interviewer when the focus of the topic is java. In the today’s world when java is in demand and the competition is tough, one should prepare for the java interview questions before going for an interview. So, let’s see the java interview questions.
1. Why multiple inheritance is not possible in java?

>> Multiple inheritance is not permitted in java because it will result into ambiguities and inconsistencies.

2. What is the difference between abstract class and abstract method?

>> Abstract class is a class that is declared abstract while, abstract method is a method without any implementation code.

3. What is the difference between runtime error and exception?

>> Each exception is a run time error, but all the runtime errors are not exceptions.

4. What is Method Overloading?

>> Method Overloading means having more than one method with same name but different number of arguments.
Eg.
class Sample
{
void method1()
{
System.out.println("This is method 1");
}
void method 2(int a)
{
System.out.println("This is method "+a);
}
}
class Main
{
public static void main(String args[])
{
Sample object=new Sample();
object.method1();
object.method2(2);
}
}

5. What is Dynamic Method Dispatch?

>> First of all Dynamic method dispatch is the best example of run time polymorphism. Dynamic method dispatch is used to solve the problem of call of overridden method at run time rather than at compile time.

6. Runnable interface comes under which package of java?

>> It comes under java.lang package which is the most basic package used in java.

7. What does JDBC stands for and why do we use it?

>> JDBC stands for Java Database Connectivity and it is used for making the connectivity between java programming language and database.

8. Why we don't use delete operator for memory deallocation?

>> Generally as in C++ we use delete operator to free dynamically allocated memory. Java takes a different approach, it deallocates memory automatically. This technique is also called as Garbage collection.

9. Why we use static in java?

>> Classes are called with the use of their objects. Static is used so that class can be called without using an object of that class.

10. What is Interface?

>> An interface is the collection of methods which does not have any implementation code or we can say that interface is the collection of abstract methods.

Hope that you will these find java questions in your interviews.
READ MORE...

Friday, June 07, 2013

C Program to find the factorial of a number

Leave a Comment Follow us on twitter
Below written is the C Program to find the factorial of n numbers where n is any input number by user whose factorial is to be computed. So, let's see the program to find factorial of number in C language.



#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int fact=1,n,i;
printf("Enter the number whose factorial you want to find : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
fact=fact*i;
printf("\nFactorial of %d is : %d",n,fact);
getch();
}

Output:


Enter the number whose factorial you want to find : 5

Factorial of 5 is : 120
READ MORE...

Thursday, June 06, 2013

Basics of Java Programming: How to write a simple Java Program

Leave a Comment Follow us on twitter
To do java programming and to become a better programmer, one should able to write the java code with less complexity and lower running time. In this java tutorial instead of focusing over Complexity and Running time of a program, we are going to learn how to write a simple java program.

class Javaprogram
{
public static void main(String args[])
{
System.out.println("This is your first java program");
System.out.print("Here you are going to learn java");
}
}

Above written eight lines of code is the simple java program one can write, but for the beginners it is very difficult to understand such creepy code. Let's understand the code. As Java is an Object Oriented Programming language so there is the use of classes, procedures, methods etc. Same applies here; in java program we start with class <Classname>. After that in the next line we use public static void main(String args[]).  Now the question arises what does that mean?

Why we use public static void main(String args[]) in java program


The answer is that public is used to make the code accessible by any object of any class from anywhere. The class is called by the object of that class, static is used to specify that it can be called without having any object, void is return type which means that nothing is returning as void means nothing/null, main is the main() function of the program. It is compulsory to use main() so that it should always called first by default. The use of String args[] is to take the command line arguments from user. The use of args[] is to specify the number of arguments to be stored in array and the return type of that array is String.

Then we use the System.out.println and System.out.print, here out means output which is belongs to System class; and println() and print() are the methods of that System class. The difference between println and print is that println show the output in next line while print shows the output in the same line.

I hope that now you will understand the above written java code and able to write java program of your own.

READ MORE...

Wednesday, June 05, 2013

Database Management System Architecture: DBMS Architecture

Leave a Comment Follow us on twitter
In this DBMS tutorial we are going to discuss about architecture of Database Management System (DBMS), also called as three-level architecture. Database Management System (DBMS) architecture is used to distinguish between the physical database and user applications. Let's see the different levels of Architecture.

Also read :



Physical Level


Also known as Internal Level. It basically describes how actually the data is stored. The reason why it is called internal level is, it has an internal schema which shows the physical storage of database. This is the first level of DBMS Architecture.

Conceptual Level


This is the second level of DBMS Architecture. It has conceptual schema which describes how the data is shown to the community users.

View Level


Also known as External Level. This is the third and highest level of DBMS architecture. As it is view level, it includes how the data is viewed to each individual i.e. user.

READ MORE...

Sunday, June 02, 2013

C Tutorial : Introduction to C language

Leave a Comment Follow us on twitter
In this C tutorial we are going to focus over the introductory part of C language. C is a very popular programming language developed by Dennis Ritchie in 1972. C is not an Object Oriented Programming language as C++ is but it is a structured language. Structured languages are easier and allow the variety of programs in small modules. So, C programs are easier to develop as compared to C++.

As C Program is high level language, so we need to convert this high level language into machine language. For this purpose there are various online C compiler and interpreter available in the market but the popular one is turbo c. These compiler and interpreter convert the high level language or assembly language into machine language (i.e. in binary form 0 and 1).


Let's see the Structure of C Program along with an example.

 
Header file section
Global variable declaration section
Main() Function (along with return type)
{
Executable statements
}
User-defined Functions
{ }


E.g.  :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\nEnter the value of a and b:");
scanf("%d%d",&a,&b);
printf("Sum of a and b is :%d",a+b);
getch();
}

=> Header file Section: This is the mandatory section. In the above program we have used two header files "stdio.h" and "conio.h". "#" is pre-processor directory and "include" is used to include stdio.h in the program. "stdio.h" means Standard Input Output and "conio.h" means Console Input Output. File comes under "stdio.h" in this program are printf and scanf while getch comes under "conio.h.".

=> Global variable declaration section: Global variable means those variables that can be used in more than one function. They are declared before the main() function.

=> Main() function : In the above program, void main() is used. All the necessary part of the program is written under main() function. You can also write int main(), float main(), double main() etc.

=> Executable statements: These are those statements that actually do some computation like a+b; etc.

=> User-defined functions: Functions are very popular in C language. To divide the big program into small modules we can use functions. It is quite helpful in recursion programs.

=> Comments: Comments are not the mandatory part of a c program but if you write comments it will help to understand the logic as well as the definition of the program. // is used to write a single line comment while /* */ is used to write multiple line comment.


E.g.:
// This is a single line comment.
/* This
is a multiple
line comment */

In this C Tutorial we discussed about introduction to C language. Hoping that you are now able to understand C and learning C is a better experience, we will see further C tutorials in later posts.
READ MORE...