Truncate & Delete
1.Truncate a table means data will be lost, but structure of the table will be present in the database.
Syntax: Truncate table <table name>;
2.If you drop a table then the structure of the table also goes along with the data.
Syntax: drop table <table name>;
3.You can’t delete a table; you can delete the data in a record wise manner.
SYNTAX: DELETE FROM <TABLE NAME> WHERE <CONDITION>
4.The difference between the truncate and delete is you can delete the data at a stretch buy using the truncate, by using the delete you can delete only one record at a time.
5.When you have truncated the table then all the records will lose. Then immediately if you add a record to that table the row number will be ‘1’ only.
Index:
1. If you have a clustered index on a column, then also you can assign a primary key to that column?
2. You are having rowid already then why you are going for the index?
3. How many non-clustered indexes can be allowed in a table?
Syntax:
Create index <index name>
On
<Table name (<col1>, <col2>, -------)>;
Syntax:
Drop index <index name>
Rules
9.Rules will maintain the domain integrity.
10.Is it possible to create a rule at the time of creating a table?
No.
11.Is it possible to drop a rule?
Yes.
12.What is the difference between the rule and check constraint?
If a check constraint is applied to a table it will enforce the constraint to previously existing data also. If that data violates the constraint then constraint statement gives an error message.
If a rule is applied on a table it will not apply to the already existing data in the table. The rule will be imposed from now on the updation and insertion of data.
SYNTAX
Create rule <rule name> as <condition>
Sp_bindrule <rule name>, <object name>
Drop rule <rule name>
24.What are the types of replication?
Types of the replications:
· Snapshot Replication
Option: Snapshot, with immediate-updating Subscribers
· Transactional Replication
Option: Transactional, with immediate-updating Subscribers
· Merge Replication
Which type of replication you choose for your application depends on your requirements for data consistency, site autonomy, and network resources.
25.Differences between the SQL-server 2000 and SQL-Server 7.0.
26.What is the sql using by the SQL-Server and oracle?
SQL-Server: Transact-SQL
Oracle: ANSI-SQL
28.Is it possible to create a view with out a base table?
Actually the answer is NO.
But this is possible by using the “FORCED VIEWS”
Syntax:
Create force view XYZ
As
Select * from ZZZ;
29.Index is the only second object, which holds data in the database.
30. “MODIFY” is a keyword only it is not a clause.
31.What will happen if you add a not null constraint on to a column if that column is already having the null values and what is the status of those null values, which are already present?
An error is given stating that null values are found.
32.I am doing a transaction, I am having four activities in those four fourth activity got some problem, then will be the transaction committed or roll backed?
Automatically it will rollback, because a transaction is said to be committed when all the activities of that transaction is perfectly executed.
Joins
33.What is a join?
34.How many types of joins are there?
35.What is the difference between the outer join and left outer join?
36.How to make a copy of a table (if you have a table with some name X, is it possible to create a table with a name Y by using the table X?
Explanation:
SQL server
SELECT <COLUMNS> INTO <NEW TABLE> FROM <OLD TABLE>
Oracle
Create table <table name> as select * from <table name>
Write a query to display the details of employees whose salary is more than the ‘BLAKE’ salary.
Sql> select B. * from EMP A, EMP B
Where A.ename=’BLAKE’
1. Sal < B.sal;
It is also called aliasing.
It is a self-joining concept.
0 comments:
Post a Comment