Showing posts with label SQL Tutorial. Show all posts
Showing posts with label SQL Tutorial. Show all posts

Thursday, 4 May 2017

How to add data to a table in sql

How to add data to a table in sql


In this post how to add data to a table in sql , we will discuss about inserting rows in sql tables. This is a very common question how to add data to a table in sql  . Adding data means inserting rows in sql tables. Before we insert data into tables , We first have to create tables in sql database. 
If the tables are already created, then before you enter data into a SQL database table, you have to know the name of the table as well as the various columns of the table. Along with names of the columns, we you have to be familiar with the data types of the various columns of the table.
Is this possible to know the name and data types of various columns of the table, yes this is quite simple to know the name of the columns and their data types. This can be done by using desc table command

Desc Table Command

The Desc Table command of SQL is to describe the structure of the table.
For example if we supply command like this : Desc employee;
This will display the whole structure of the employee table. It will display the name of the columns along with column specifications.
When you came to know the names of various columns and their data types, their widths and constraints, we can add rows to the table.
While inserting rows into tables, you have to take care with number of columns and their data types.
 
How to add data to a table in sql 1
How to add data to a table in sql

How to add data to a table in sql


To  to add data to a table in sql, we have to use insert into command. The use of sql insert statement is quite simple. 
sql insert statement
The sql insert statement is helpful in adding new rows to a table in sql.

The General Syntax of sql insert statement

Insert into <table name> values (value1, value 2,…);

Here table name is the name of the table in which you wants to add rows.
Suppose the name of the table is employee, the insert statement will be like this;

Insert into employee values (101, ‘SAM’);

After execution of the statement, the following message will be displayed
I row(s) created.
Here, you have to be care full, 101 will be added to first column of the table and SAM will be added to the second column of the table.
It is necessary to take care of data types of while inserting rows in a table.                   
With one insert into command, you can add only one row in a table. For Multiple rows , we have to use insert into command multiple times.
Few more examples of Insert into Command.
Given a table named employee with columns ecode->char(4), ename->varchar2(30), ecity->varchar2(30)
  Employee Table
Ecode
Ename
Ecity

Insert into employee values (‘E001’,’SAM’,’Florida’);
Here the first value E001 will be stored in first column of the table, second value SAM will be stored in second column of the table and third value Florida will be stored in  the third column of the table. In this case, user must be aware about the sequence of the columns of employee table. If by mistake he supply insert into command as Insert into employee values (‘SAM’,’E001’,’Florida’);
In this case employee name will be stored in employee code column and employee code will be stored in employee name column.

To avoid such problems, supply insert into like this:

Insert into employee(ecode, ename, ecity ) values (‘E001’,’SAM’,’Florida’);
How to add data to a table in sql oracle

How to add data to a table in sql

This will add a row in database table, in this case E001 will be stored in ecode, SAM will be stored in ename and Florida will be stored in ecity column of the employee table.
Main thing here is , you don't have to remember the sequence of columns in the table. You can supply the above insert into command as : Insert into employee (ename, ecode, ecity ) values (‘SAM’,’E001’,’Florida’);

Here you can see, we had altered the sequence of values, we had written SAM as first value and E001 as second value, we had also altered the sequence of column names in the above statement, ename is given first and then ecode.

How to insert multiple rows in SQL Table

To insert multiple rows in a table,  we have to supply insert into command as
Insert into employee values (&eocde, &ename,&ecity);

When you supply this command, the following output will be generate.

Enter Value for Ecode :
Here you have to supply value for ecode like ‘E001’
After this you will get –
Enter Value for Ename :
Here you have to supply value for ename like ‘SAM’
After this you will get –
Enter Value for Ecity :

Here you have to supply value for ecity like ‘Florida’

After this following message will be generated –
1 row(s) created.

After this sql prompt will come.
Sql>

Here you have to write run
Sql>run;

Run command of sql executes the last executable statement stored in Sql buffer. In this case it is : 

Insert into employee values (&eocde, &ename,&ecity);
Again you have to supply new values, you can repeat this step for as many times as you want.
So this was all about How to add data to a table in sql
Summary
We hope this post How to add data to a table in sql is informative and helpful to you. If you wish you can ask any question regarding this post. We will appreciate social media share of this post by you.


Wednesday, 3 August 2016

Top SQL Interview Questions and Answers for 5 Years Experience



Top SQL Interview Questions and Answers for 5 Years Experience



Objective of the post Top SQL Interview Questions and Answers for 5 Years Experience is to provide beginners as well as professionals a ready reckon er of SQL. What are Top SQL Interview Questions and Answers for 5 Years Experience We have tried to enlist here Top SQL Interview Questions and Answers for 5 Years Experience.

        
 SQL Interview Questions and Answers

SQL Interview Questions and Answers


             Top SQL Interview Questions and Answers for 5 Years Experience


                Explain Group by and Having clause
                What is view? How it is created? How it is destroyed Explain with example

                Explain IN, LIKE and BETWEEN operators with example

                Write features of SQL

                What is foreign key

                What is primary key

                What are constraints? What is there significance?

                Explain any 4 data types in oracle

                Explain implicit cursor and explicit cursor

                Define JOIN

                Define GRANT

                Define REVOKE

                What are sequences? How it is created? How sequences are altered and dropped? Write syntax for each.
                Consider  table name ABC, with column name, job, dept no sal, emp no,comm.
                Write command for following:-
                (a) List name of clerk working in dept no  20;
                (b) List name of employee with emp no 101,150,200,261 using IN operator
                (c ) List name of employee  whose salary is none than 10000
                (d) List name, emp no, sal in ascending orders of salary
                What is oracle engine
                Discuss different section of PL\SQL block? How do you create and execute PL\SQl block
                Define server
                Define data base
                What is significance of index
                Write command to destroy table
                Write full form of SQL
                (a) DBA
                (b) DDL
                Why do we use aliases name
                Define cursors
                Define view
                Define RDBMS

             
SQL Interview Questions and Answers

 SQL Interview Questions and Answers

                  

                EXPLAIN FOR LOOP & WHILE LOOP WITH EXAMPLE.
                DESCRIBE WHILE LOOP IN PL/SQL.
                DEFINE NOT NULL CONSTRAINTS.
                DEFINE PRIMARY KEY.
                DEFINE AGGRGATE FUNCTIONS.
                WHAT IS EXPLICIT CURSOR.
                DEFINE SYNTAX.
                DEFINE JOIN.
                DEFINE FUNCTION.
                DEFINE VIEW.
                DESCRIBE SELFJOIN IN DETAIL.
                EXPLAIN CURSOR.
                DESCRIBE IMPLICIT CURSOR ATTRIBUTE IN DETAIL.
                EXPLAIN ANY TWO:-
                (a) ROLLBACK STATEMENT.
                (b) UNION.
                © CREATION OF TABLE.
                EXPLAIN THE ARCHITECTURE OF CLIENT SERVER IN DETAIL.
                STATE HOW SQL COMMANDS ARE CLASSIFIED?
                DEFINE RDBMS.
                EXPLAIN IMPLICIT AND EXPLICIT CONVERSION IN DETAIL.
                WRITE A PL/SQL CODE FOR INVERTING A NUMBER 3927 TO 7293.
                EXPLAIN DATA MANUPULATION COMMAND IN DETAIL.
                EXPLAIN THE RESTRICTION RELATED TO UPDATION, DELETION & INSERTION     
                OF RECORDS ON VIEW.
                DEFINE PL/SQL.
                DEFINE DATA AND GROUP FUNCTION.

                Top SQL Interview Questions and Answers for 5 Years Experience

                Define PL/SQL
                What are the component of SQL? Explain with example?
                Explain Group  function
                Define TCL
                Explain buffer pool
                Define Select statement
                Define foreign key constraint
                Define cursor
                Explain BLOB and CLOB?
                Discuss DEAD-LOCK?
                Explain the different data constraint in detail in SQL?
                Explain the iterative control in PL/SQL control structure?
                Define loading
                Define EQUI Join and Self Join
               Define Advantages of PL/SQL
                Define  Creation of simple and unique index.
                Explain various features and rules for SQL?
                Explain the step by step installation of ORACLE 8I data server?
                Discuss cursor management? Explain about implicit and explicit in brief?
                Discuss error handling in PL/SQL?
                Explain  Update the contents of a table?
                Explain  Renaming of tables?
               Explain Destroying of tables?
                Explain the various methods of which data can be managed?
                Define SQL
                Define synonym?
                Using the sample student table and branch of student table for solving the queries given below:
                (i) Display the name of all the student along with the percentage of marks and semester>
                Top SQL Interview Questions and Answers for 5 Years Experience
               
Top SQL Interview Questions and Answers for 5 Years Experience

SQL Interview Questions and Answers 

                Differentiate between view and object view?
                Define Domain Integrity?
                Define locking?
                Define Transaction Control command?
                Steps in invoking SQL*PLUS(any three)
                What is SQL?
                Define DML?
                Define synonym?
                What is group function?
                What are the components of SQL? Explain with example?
                How can duplicate records can be avoided in oracle ? Define the concept or error handling?
                Types of SQL?
                What are composite data types in PL/SQL and what are its advantages?
                Explain partitioning in INDEX and drop database object?
                Explain Join? What are the various types of joins are used in SQL*PLUS(giving syntax of each).
                Explain  the introduction of ORACLE 8i
                What are various privileges and transaction control commands in SQL*PLUS?
                Using the sample employee table and department , table for solving the queries given below:
                Display the name iof all the employee along with job and salary .
                Explain cursor management? What are explicit and implicit cursor?
                Explain the architecture of PL/SQL? What are its advantages?
                Explain Codd Rules
                Explain Packages
                Explain Locking and types of Locking ?

                Top SQL Interview Questions and Answers for 5 Years Experience

               
                Explain Single Row Functions in SQL*PLUS with the help of example?
                State the restrictions imposed on relations in a relational models?
                Components of ORACLE 8
                What is SQL*PLUS
                What is self join?
                Define exclusive lock?
                What is control functions?
                Define partition view?
                Define database object?
                How are entities and attributes are related to each other?
                What are the components of SQL? Explain with example?
                What are editing commands in SQL*PLUS environment? Explain each of their with example?
                What are the various types of character , numeric and conversion functions available in
                SQL*PLUS. Explain in detail with syntax of each of them?
                Explain RDBMS and its relationship among data?
                What do you mean by integrity constrains in SQL*PLUS? Explain in detail?
                What are subprograms and procedures ? What are the advantages of using subprograms and
                procedures?
                Solve the query :
                List the employee names with the third character as 'R'.
                Explain the architecture of PL/SQL and their advanta\ages?
                State some of the points related to query statement?
                What is the concept of locking? What are the various types of locks used in SQL*PLUS?

                Top SQL Interview Questions and Answers for 5 Years Experience

               
                What is sql ?describe its various feature.
                Describe the Interactive construct and its types in detail?
                DEFINE GROUP FUNCTION.
                DISCUSS FOREIGN KEY.
                Define PL/SQL.
                WHAT IS IMPLICT CURSOR?
                Define Field?
                EXPLAIN ALTER COMMAND.
                DEFINE DOMAIN CONSTRAINTS.
                DEFINE NESTED IF STATEMENT IN PL/SQL.
                Explain Null value?
                Explain various steps to implement a cursor in SQL?
                Explain any Two:-
                (1)SAVE POINT Statement.,
                (2)REVOKE Command.
                (3)RENAMING Table.
                Explain the different command for modifying the structure of a Table?
                DEFINE UNION.
                Describe the types &characteristics of  views.
                Write a PL/SQL code for inverting number 2488 to 8642.
                Explain different Identifiers and Data types in Oracle?
                Explain the various steps involved in creating a cluster and its table in detail?
                Define various application tools in oracle.
                Define Entity?
                Write the syntax and example of arithmetic and character function.
                DEFINE SEQUENCE.

                Top SQL Interview Questions and Answers for 5 Years Experience

                Where is TCl used?
                What is relation?
                Explain different types of cursors and Database triggers?
                Explain different types data and their usage?
                Explain SQL*PLUS formatting commands?
                Describe locking? What are its types?
                Explain data manipulation commands?
                What do you mean by portability?
                What is TCL?
                What are conversion function in oracle ?
                What are table define commands?
                Explain the use of SQL forms?
                Define RDBMS?
                Define sorting?
                What is view?
                What are duties and responsibilities of  DATA BASE ADMINISTRATOR?
                Explain the concept of data independence?
                Oracle is single user or multi user operating system. COMMENT
                What is the use of JOIN statement?
                What is data security and integrity. How is it achieved in Oracle?
                Explain CODD’S rules?
                Define SQL?

                Top SQL Interview Questions and Answers for 5 Years Experience

               
                Why NULL not used with relational operators?
                Define sub program?
                Define normalization?
                What is conceptual design?
                What is DML?
                Define domain?
                Define RDBMS?
                Solve the following queries based on  tables given below:
                EMP(EMPNO,ENAME,JOB,SAL,COMM,DEPTNO)
                DEPT(DEPTNO,DNAME,LOC)
                i) List the name and salary of the employees whose salary is more than 1500
                ii) List the employees details not belonging to the department 10,30,and 40
                iii)List the empno,ename,sal in ascending order of salary
                iv) List the department numbers and of employees in each department.
                V) List the number of employees working with the company
                Define the term attribute?
                Explain different types of set operators available in ORACLE with suitable example?
                Explain the concept of packages in detail. Also write their advantages?
                Explain ERROR HANDLING
                Explain CURSOR MANAGEMENT
                Explain entity- relationship approach of data modeling?
                What are table definition commands? Explain with suitable example?
                Write advantages of PL/SQL?
                Name different table definition commands?
                What is the use of privilege command? Discuss any two of them?
                What do you mean by locking? Discuss its various types?
                Explain the term view? For what purpose a view is created?
                Discuss various control structures available in PL/SQL?
                What is codd's rule?
                What are single row functions? Explain
                Define primary key?
              

SQL Interview Questions

Top SQL Interview Questions and Answers for 5 Years Experience

               
              Explain Exclusive lock
               what is a procedure and a package? What are the advantages of using procedures and  package     in      PL/SQL? Give the syntax of writing a package and a procedure in PL/SQL.
                Explain PL/SQL composite data types?
                What are single -row and group functions? give five example both single-row functions and group  functions along with    
               their syntax.
                Explain views
                Explain procedures
                Explain synonyms
                correlated sub query
                Give an example of a sub query that returns several values using SQL
                How can we create sequences and views in ORACLE? Give example along with the syntax
                Group Functions
                What do you mean by cursors? What are the different types of cursors that can be written in
                PL/SQL? Give syntax of each.
                What are the data types of ORACLE?
                How can duplicate records be avoided in ORACLE?
                Give example using SQL for the retrieval with sub query with same table involved?
                What are the various types of character, numeric and conversion functions available in
                SQL*PLUS? Explain in detail with syntax of each of them.
                hat are the various privilege and transaction control commands in SQL*PLUS? Give syntax with
                example of each of them?
                What are PL/SQL composite data types? What are advantages of PL/SQL

                What is the concept of locking? What are the various types of locks used in SQL * PLUS?
                what do you mean by integrity constraints in SQL* PLUS? Explain in detail.
                self join
                write a short note on "introduction to oracle 8i".
                count functions

                Top SQL Interview Questions and Answers for 5 Years Experience

               
                Explain the various data types used in PL/SQL. Explain their usage
                describe the cursors and database triggers in PL/SQL
                Explain any three numeric functions available in SQL*PLUS
                what is the use of privilege commands? Discuss any two of them
                Explain the term "view" .For what purpose view is created.
                what are single row functions? Explain
                what do you mean by locking? Discuss the various types
                what are table definition commands? Explain with suitable examples
                what is an index? How partition is done in an index. Explain with examples
                what do you mean by multiple sub queries
                Define the term attribute
                enumerate any two control structures using PL/SQL
                What is subprogram?
                what is referential integrity
                What are conversion functions in SQL*PLUS. Illustrate (to-char, to-date) functions.
                Discuss the various formatting commands in SQL*PLUS
                what do you mean by Primary and Secondary Key
                What is Codd's Rule
                Define the term attribute
                what is conceptual design
                why is NULL not used with relational operators
                what is normalization
                what do you mean by one to many relationship
                Top SQL Interview Questions and Answers for 5 Years Experience
               
                Explain the PL/SQL block structure in oracle.
                Define RDBMS by giving suitable example.
              Explain Oracle and client server technology
              Explain Advantages of PL/SQL
               What is the sequence in oracle? Explain the syntax and purpose of creating a sequence,
                referencing a sequence and dropping a sequence.
                Explain different types of data constraints with example.
                Explain Group Function and Scalar Function in oracle.
                What are various data types used in ORACLE? Explain.
                What is DBA? Define.
                Define Index. Explain various types of indexes. Write syntax with example for creating Index.
                What are the various loops used in oracle? Explain.
                Define DML.
                Define Revoke Privilege.
                Define Tuple.
                Define self Join.
                Explain Pattern matching in oracle with example.
                Define cursors. Explain explicit cursor with example.
                Define SELF JOIN with syntax.
                Define UNION with syntax.
                Define INTERSECT clause with syntax.
                Explain the use of Indexing in oracle.
                Define view. Give suitable example. What is the significance of using a view?
                Name the types of locks used in oracle.
                Define primary key.

                Top SQL Interview Questions and Answers for 5 Years Experience

               
                what is column command
                what is self join
                define the term subprogram
                What do you understand by term domain?
                write the definition of RDBMS
                Write the advantages of PL/SQL
                What is DML
                what is implicit cursor
                List the privilege commands
                What do you mean by primary key?
                Explain the internal data types?
                Discuss the various control structures available in PL/SQL
                Name different table definition commands
                what are count functions
                Explain different types of set operators available in ORACLE with suitable examples.
                Explain the entity relationship approach of data modeling?
                Explain the cursor management in ORACLE?
                Explain the features of ORACLE
                differentiate between subprograms and procedures in PL/SQL
                Explain error handling in ORACLE
                Write short notes on :
                (1) Formatting Commands
                (2) Tools of ORACLE
                Explain the data manipulation and privilege commands in ORACLE
                Discuss the table commands with
                Top SQL Interview Questions and Answers for 5 Years Experience
                Explain the internal data type.
                discuss the various control structure available in pl/sql.
                Explain different type of set operator. With suitable example.
                Explain error handling in oracle.
                what is implicit cursor?
                Explain the entity relationship approach of data modeling.
                Explain the cursor management in oracle.
                Explain the features of oracle.
                Differentiate between subprograms and procedures in pl/sql.
                Explain the data manipulation and privilege commands in oracle.
                discuss the table commands with suitable example.
                define the term subprogram.
                what is dml
                what do you mean by primary key.
                what is column command?
                write the advantage of pl/sql.
                write the definition of rdbms.
                what do you mean understand by term domain.
                name different table definition commands.
                what are count function?
                what is self join.
                list the privilege commands.

            
SQL Interview Questions and Answers

 SQL Interview Questions and Answers

               
                List the name of oracle client tools?
                Define view.
                Write the purpose of Union.
                Difine EQUI JOIN.
                What is an entity?
                Write the purpose of RAVOKE command.
                Define Index.
                What are oracle client tools?
                Describe the meaning of oracle transaction? How procedure of closing a transaction and creating
                Explain syntax of insertion, viewing, deleting and updating of tables in SQL with suitable example.
                Describe 'Having' clause.
                What do you understand by cell length and cell name?
                what do understand by cursor? Explain different type of cursors. How cursors can be
                Parameterized? Explain with examples
                What are the different products that are known as oracle's suit of products? Write purpose of
                each product.
                Explain various Data Types in Oracle.
                What is the purpose of range searching?
                Define primary key.
                What is the significance of Data Constraints? Explain different type of Data  constraints ?How
                data constraints can be defined and dropped in the ALTER TABLE command?
                How PL/SQL is different from SQL? Explain it.
                Explain the Clint Server Architecture in detail with help of neat diagram.
                How SQL performance Tuning can be performed? Explain it.
                What do you understand by RDBMS software? Write down the features of Oracle software.
                What are sequences ? How sequences can be created, altered and  dropped?

                Top SQL Interview Questions and Answers for 5 Years Experience

                               
                Explain with syntax the steps involved in creating a cluster and its table.
                Explain different types of normal forms with suitable example.
                Write PL/SQL code to print first ten odd numbers?
                what are parameterized cursors? Explain.
                What are variables? Explain.
                Explain with an example to create an index?
                Define DELETE command with example?
                Explain architecture of client server?
                What are features of oracle?
                Explain character functions?
                what do you mean by privileges?
                Define oracle engine?
                Write syntax of grant command?
                What do you mean by database tuning?
                what are the uses of functions?
                what are single row functions?
                Differentiate between index and unique index?
                what is difference between DCL and DDL?
                Differentiate between DMBS and Rdbms
                What do you mean by sequence?
                State some dis-advantages of a view?
                Top SQL Interview Questions and Answers for 5 Years Experience
               
                How pl/sql differs from sql.
                What are the feature of sql.
                what are composite data types of pl/sql.
                what do you mean by cursor? Explain explicit cursor attributes.
                Define sql.
                Explain control statement of pl/sql.
                Define rdbms.
                what are the components of sql.
                write about like and in clause.
                how security can be achieved in oracle.
                Explain group function of sql.
                what is difference between char and varchar2 data type.
                define cursor in pl/sql.
                consider the table employee with column names ecode,ename and salary solve the following .
                1) give ename all the employees.
                2) give ecode and ename of all the employees whose salary is greater than 10000.
                3) give name of all the employees whose city starts from letter 'a'.
                what do you mean by index and Explain unique and composite indexes in detail.
                write a program in pl/sql to print table of a number.
                what is index.
                what do you mean by exception in pl/sql.
                Explain any two number function.
                write syntax of loop.
                define view.
                define primary key.
                define synonym.
                What is not null constraint.

             
SQL Interview Questions and Answers for 5 Years Experience

Top SQL Interview Questions and Answers for 5 Years Experience

               
                How can duplicate records can be avoided in oracle? Define the concept of error handling.
                Define RDBMS.
                What are the components of SQL? Explain with example.
                Explain Partitioning in index & drop database object.
                Explain the architecture of PL/SQL.
                What are its advantages.
                Explain cursor management , What are implicit & explicit cursor.
                Using the sample employee table & deptt.,table for solving the queries given below:-
                Display the name of all the employees along with job & salary
                What are the various Privilege& transaction control commands in SQL*PLUS?
                Explain join. What are the various types of join are used in SQL*PLUS (giving syntax of each)
                What are the composite data types in PL/SQL and what are its advantages.
                Explain the introduction to oracle 8i?

 Ignore searches
  • advanced sql interview questions    ,
  • oracle sql interview questions and answers    ,
  • oracle sql interview questions and answers for experienced    ,
  • sql dba interview questions and answers for experienced    ,
  • sql interview questions and answers for experienced    ,
  • sql interview questions and answers for experienced pdf    ,
  • sql interview questions and answers for experienced testers    ,
  • sql interview questions and answers for freshers    ,
  • sql interview questions and answers for testers    ,
  • sql interview questions and answers multiple choice    ,
  • sql interview questions and answers pdf    ,
  • sql interview questions and answers pdf for testers    ,
  • sql query interview questions and answers    ,
  • sql query interview questions and answers for experienced    ,
  • sql server interview questions and answers    ,
  • sql server interview questions and answers for experienced    ,
  • technical interview questions and answers    ,

Summary

 
Hope this post Top SQL Interview Questions and Answers for 5 Years Experience is helpful for all those who are studying computer engineering as well as electronics engineering.
We will appreciate social media share of this post.
Please click on twitter or Facebook buttons in the end of this post.