Showing posts with label software testing help. Show all posts
Showing posts with label software testing help. Show all posts

SQL-Insert Statemnet


Insert: Insert Statement is used to insert values in tables. In Insert Statement the number of columns and values must be the same. If a column is not specified, the default value for the column is used. 

SQL Syntax would be as follows: 
Insert into tablename (column1, column2, column3) values (value1, value2, value3)

                                          (Or)
Insert into table name values (value1, value2, value3)


By using these two statements we can insert required data to the required table.


Example for Insert Statement:
Insert into Employee (empid, First Name, Last Name, Deportment, Address, City) values (001,’sam’, ‘Prasad’, ‘QA’, ‘XYZ Automobiles’, ’Delhi’);
After running the query "Employee" table will now look like this:





empid
First Name
Last Name
Deportment
Address
City
 001
 sam
prasad 
 QA
XYZ Automobiles 
 Delhi























It is not need to specify the all column(s) name in the SQL query if we are adding values for all the columns of the table. But make sure the order of the values is in the same of order as the columns in the table.
Insert into Employee values (001,’sam’, ‘Prasad’, ‘XYZ Automobiles’);
Table name is Employee
After running the Second query "Employee" table will now look like this:





empid
First Name
Last Name
Deportment
Address
City
 001
 sam
Prasad 

XYZ Automobiles  


































SQL Syntax

For  Quick View we are giving SQL syntax here:

1)SQL Create Database Syntax:
Create Database database name;


2)SQL Drop Database Syntax:
Drop Database database name;


3)SQL Create Table Syntax:
Insert into table name (Column Name1 data type(size), Column Name1 data type(size), Column Name2 data type(size), Column Name3 data type(size));

Insert into table name values(valur1,valu2,value3;)


3)SQL Update Table Syntax:
Upadate Table table name (Column Name1 data type(size), Column Name1 data type(size), Column Name2 data type(size), Column Name3 data type(size));


4)Syntax for SELECT Statement:
If we want to select all columns form the table then the SQL query will be
Select * from tablename;

If we want to select selected columns form the table then the SQL query will be
Select column1, column2, column5 from tablename;


5)SQL WHERE Clause:
Select column1, column2, column5 from tablename where (Condiation);


VB Script Initializations


VB Script Variables: Variable is nothing but we are allocating some space to the particular variable to store some information. In variables we are storing the information to that value.
A=10

Here A is Variable Name
 In VB Script we have two types of Variables.

1) User defined Variables
2) Pre-defined Variables.

Variables: 
For example:  a= 1o, dim =10
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.

1) User defined Variables: In user defined variable user will define the variable name.
For example:  a= 1o
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.
 2) Pre-defined Variable: pre-defined variable means Vb Script having default variables those variables are called Pre-defined.

For example:  dim= 1o
                       Here a=variable name
                       10=we are assigning one value to the particular variable.

In this example dim is a pre-defined variable. We can’t use that variable as a user defined variable.

Variables in VB Script

VB Script Variables: Variable is nothing but we are allocating some space to the particular variable to store some information. In variables we are storing the information to that value.
A=10
Here A is Variable Name

In VB Script we have two types of Variables.

1) User defined Variables
2) Pre-defined Variables.

Variables: 
For example:  a= 1o, dim =10
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.

1) User defined Variables: In user defined variable user will define the variable name.
For example:  a= 1o
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.
 2) Pre-defined Variable: per-defined variable means Vb Script having default variables those variables are called Pre-defined.

For example:  dim= 1o
                       Here a=variable name
                       10=we are assigning one value to the particular variable.

In this example dim is a per-defined variable. We can’t use that variable as a user defined variable.