|Hypertext Markup LanguageCascading Style SheetsExtensible Markup LanguageJava ScriptjQueryAngularJSOracle SQLOracle PL/SQLOracle D2K FormsOracle D2K ReportsOracle DatabaseJavaJava Database ConnectivityJava ServletJava Server PagesHibernateApache TomcatCC++PHPMy-SqlUnix/LinuxMS-DOSHR Interviews|
What is SQL?
Structured Query Language (SQL) is a language that provides an interface to relational database systems.
|Difference between TRUNCATE, DELETE and DROP commands?|
DELETE command is used to remove some or all rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to COMMIT or ROLLBACK the transaction to make the change permanent or to undo it. Note that this operation will cause all DELETE triggers on the table to fire.
TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired. As such, TRUNCATE is faster and doesn't use as much undo space as a DELETE.
DROP command removes a table from the database. All the tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation cannot be rolled back.
DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command. Therefore DELETE operations can be rolled back (undone), while DROP and TRUNCATE operations cannot be rolled back.
DELETE will not free up used space within a table. This means that repeated DELETE commands will severely fragment the table and queries will have to navigate this "free space" in order to retrieve rows.
How does one eliminate duplicate rows from a table?
To remove duplicate rows of data, use the following statement: it will remove duplicate rows from a table and leaving only unique records in the table:
Delete from table_name where rowid not in (select max(rowid) from table group by duplicate_values_field_name);
What the difference between UNION and UNION ALL?
Both UNION and UNION ALL is used to combine results of two SELECT queries.
select * from T1 A 1 1 1 select * from T1 union select * from T1 A 1 select * from T1 union all select * from T1 A 1 1 1 1 1 1
How to Change a SQL prompt name?
SQL> set prompt oracle oracle>
Find out nth highest salary from emp table?
With the help of correlated sub-query, ROW_NUMBER(), dense_rank() and RANK() , we can find nth highest salary -
SELECT * FROM Employee order by 2 NAME SALARY Ram 3000 Tom 3000 Vinod 4000 Venky 5000 Manoj 7000 SELECT DISTINCT (a.salary) FROM Employee A WHERE &N = (SELECT COUNT(DISTINCT(b.salary)) FROM Employee B WHERE a.salary <= b.salary); N= 2 -- to identify 2nd highest salary SALARY 5000 SELECT DISTINCT (salary) FROM (SELECT e.*, ROW_NUMBER() OVER(ORDER BY salary DESC) rn FROM Employee e) WHERE rn = &N; N= 3 -- to identify 3rd highest salary SALARY 4000 SELECT * FROM (SELECT name, salary, DENSE_RANK() OVER(ORDER BY salary DESC) nth_highest_sal FROM Employee ) WHERE nth_highest_sal = &n; N= 3 -- to identify 3rd highest salary SALARY 4000 SELECT * FROM (SELECT name, salary, RANK() OVER(ORDER BY salary DESC) nth_highest_sal FROM Employee ) WHERE nth_highest_sal = &n; N= 3 -- to identify 3rd highest salary SALARY 4000
What is the difference between CHAR, VARCHAR and VARCHAR2 data types?
CHAR should be used for storing fixed length character strings. String values will be space/blank padded before stored on disk. If this type is used to store variable length strings, it will waste a lot of disk space.
|What is difference between Co-related sub query and nested sub query?|
Correlated sub query runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query.
Select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max (basicsal) from emp e2 where e2.deptno = e1.deptno)
Nested sub query runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row.
Select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max (basicsal) from emp group by deptno)
|What are the more common pseudo-columns?|
|its associated with table but its a not a part of the table. for example SYSDATE, USER, UID, CURVAL, NEXTVAL, ROWID, ROWNUM|
|What is the difference between group by and order by?|
|Group by controls the presentation of the rows, Order by controls the presentation of the columns.|
|What keyword does an SQL SELECT statement use for a string search?|
|The LIKE keyword used for string searches. The % sign is used as a wildcard and _ for single.|
|What are various constraints / Integrity Constraints used in SQL?|
Data integrity allows defining certain data quality requirements that the data in the database needs to meet.
|What is difference between UNIQUE and PRIMARY KEY constraints?|
Difference is that Primary Key have an implicit NOT NULL constraint while Unique Keys do not.
|When do you use WHERE clause and when do you use HAVING clause?|
|WHERE clause applies to the individual rows. HAVING clause is used when you want to specify a condition for a group function and it is written after GROUP BY clause.|
|What are the difference between DDL, DML and DCL commands?|
DDL - Data Definition Language: statements used to define the database structure or schema. Some examples:
|What are sequences? Explain with syntax?|
A field in oracle can be kept as auto incremented by using sequence. it can be used to create a number sequence.
e_seq will cache up to 20 values for performance. Starts from one.
CREATE SEQUENCE e_seq MINVALUE 1 MAXVALUE 99999 START WITH 1 INCREMENT BY 1 CACHE 20;
|Ratio and Proportion|
175 men can dig a canal of 3150 meters long in 36 days. How many men are required to dig a canal of 3900 meters long in 24 days?
24 men working at 8 hours a day can do a piece of work in 15 days. In how many days can 20 men working at 9 hours a day do the same work?
10 men can lay a road of 75 Km long in 5 days. In how many days can 15 men lay a road of 45 Km long?
Rice costing Rs. 480/- is needed for 8 members for 20 days. What is the cost of rice required for 12 members for 15 days?
The mess charge for 35 students for 24 days is Rs. 6300/-. In how many days will the mess charges be Rs. 3375/- for 25 students?
|Time and Work|
18 men can dig a well in 10 days. After they have worked for 4 days, how many more men shall be employed to complete the work in 4 days from then?
If 80 men can do a piece of work in 10 days, how many men are required to do the same work in 4 days?
If 80 men can do a piece of work in 10 days, in how many days can 40 men do the same piece of work?
|General Computer Knowledge|
What kind of material does ‘IC’ in computers made of?
The force required to produce an acceleration of 4 m/s2 in an object of mass 9 kg is?
Some seeds have hooks and spines. It helps the seeds to__________?
Which of the following modes of heat transfer is faster?
Which of the following reproduces from underground stem?
Lichens are a symbiotic association of?
The unit of relative density is?
|Problems on Ages|
The ages of Gyanendra and Jitendra are in the ratio of 12:7 respectively. After 6 years, the ratio of their ages will be 3:2 respectively . find the difference in their ages?
|Time and Work|
X can do a piece of work in 20 days, while Y can do in 10 days. If Y worked at it for 8 days,then X can finish the remaining work in______.?
In a certain code, BELIEF is written as AFKKDI. How is SELDOM written in that code?
|Jobs in Jharkhand|
Jharkhand Staff Selection Commission (JSSC) -JANMCE - 1985 Posts - 04/10/2019 Last date
|Jobs in Madhya Pradesh|
National Health Mission (NHM) - 1392 Posts - 05/10/2019 Last date
|Jobs in Bihar|
Bihar Vidhan Parishad - 136 Posts - 11/10/2019 Last date
NABARD - 91 Posts - 02/10/2019 Last date
Institute of Banking Personnel Selection (IBPS) - CRP Clerks-IX - 12075 Posts - 09/10/2019 Last date
Haryana State Cooperative Apex Bank Ltd - 978 Posts - 31/08/2019 Last date
Kanchipuram Central Cooperative Bank - 238 Posts - 05/09/2019 Last date
Bank of Maharashtra - 46 Posts - 19/08/2019 Last date
LIC Housing Finance Limited - 300 Posts - 26/08/2019 Last date
|Jobs in Gujarat|
Gujarat Subordinate Service Selection Board (GSSSB) - 408 Posts - 24/08/2019 Last date