Académique Documents
Professionnel Documents
Culture Documents
Q2. What is normalization and what are the five normal forms?
A3. These are attributes of one table that have matching values in a
primary key in another table, allowing for relationships between
tables.
Q6. What techniques are used to retrieve data from more than one
table in a single SQL statement?
A6. Joins, unions and nested selects are used to retrieve data.
A7. A view is a virtual table made up of data from base tables and
other views, but not stored separately.
A8. An outer join includes rows from tables when there are no
matching values in the tables.
Q9. What is a subselect? Is it different from a nested select?
Q11. What keyword does an SQL SELECT statement use for a string
search?
A11. The LIKE keyword allows for string searches. The % sign is
used as a wildcard.
Q12. What are some sql aggregates and other built-in functions?
A13. SUBSTR is used for string manipulation with column name, first
position and string length used as arguments. Eg. SUBSTR (NAME, 1
3) refers to the first three characters in the column NAME.
A16. A NULL value takes up one byte of storage and indicates that a
value is not present as opposed to a space or zero value.
A19. Never. New primary key values are not a problem. However,
the values of foreign key inserts must have corresponding primary key
values in their related tables. And updates of primary key values may
require changes in foreign key values to maintain referential
integrity.
A21. Any subselect can be rewritten as a join, but not vice versa.
Joins are usually more efficient as join rows can be returned
immediately, subselects require a temporary work area for inner
selects results while processing the outer select.
A26. A,B,C. Not all SQL implementations have a BLOB or a BIT data
types.
Sql server can have 2 billion tables per DB and 1024 columns per
table.
@@Error displays the error number for the last SQL statement
executed. The value is zero, if there is no error.
Implementation of relationships
Q. Why one should not prefix user stored procedures with sp_?
A. If the stored procedure starts with sp_, sql server first searches
that sp in master database and comes to current database. The stored
procedures in master database is global, It is available to all DB’s. It
becomes a performance issue.
Query Execution plan deals with the sequence in which the source
tables are accessed, and the methods used to extract the data from
the table.
The two virtual tables that will be used by trigger are Inserted and
Deleted tables.
The SELECT statement that gets data from the Customers table is the
derived table.
Snapshot replication:
It distributes data exactly as it appears at a specific moment in time
and doesn’t monitor for updates. It can be used when data changes
are infrequent. It is often used for browsing data such as price lists,
online catalog, or data for decision support where the current data is
not required and data is used as read only.
Transactional replication:
With this an initial snapshot of data is applied, and whenever data
modifications are made at the publisher, the individual transactions are
captured and propagated to the subscribers.
Merge Replication:
It is the process of distributing the data between publisher and
subscriber, it allows the publisher and subscriber to update the data
while connected or disconnected, and then merging the updates
between the sites when they are connected.
Q) Write a query to update all the names that has spaces in front of
their names (above table).
A) Update emp set empname='updated' where empname in (select
empname from emp where empname like ' %')
Temporary tables are like permanent table but they are created in
tempdb, and they are deleted automatically when no longer in use.
1) Select count (*) from table--- It will do full table scan, performance
factor
2) Select rows from sysindexes where id=object_id ('table_name') and
indid<2
Use constraints instead of triggers, rules and defaults, because
constraints are more efficient and boost performance.
Two types of BCP – Logged and Non-logged BCP, Logged BCP will
log the modifications and can be used for recovery, whenever there is
a failure and it is slow,
Non-logged is fast.
The database can be detached from one server and can be attached
to another server/instance or to the same server leaving the data
intact, while drop statement removes the database permanently.
1) XML support
2) Table data types
3) Instead of Triggers
4) Cascading
5) Indexed views
Databases Comments
Microsoft SQL Microsoft SQL Server™ 6.5 fully supports Microsoft
Server™ Transaction Server
IBM DB2 IBM DB2 is fully supported in the Microsoft
Transaction Server 2.0 release. See "Using an IBM
DB2 Database with Microsoft Transaction Server"
below for more details.
Oracle Oracle 7.3.3 and later releases and Oracle 8 are
fully supported in the Microsoft Transaction Server
2.0 release. See "Using an Oracle Database with
Microsoft Transaction Server" below for more
details.
Database Comments
StarQuest StarSQL StarQuest's StarSQL Pro allows Microsoft
Pro Transaction Server components to access IBM DB2
databases on Windows NT, OS/2, AIX, AS/400,
and MVS.
Restrictions:
Restrictions:
Restrictions:
Database Comments
Lotus Notes Lotus Notes has not committed to supporting
Microsoft Transaction Server.
Oracle RDB Oracle RDB currently has no plans to support
Microsoft Transaction Server.
For databases that do not support transactions, only the first two
requirements apply.
We are doing a great deal to assist database and ODBC driver vendors
to support Microsoft Transaction Server. We have contacted all of the
leading database and ODBC driver vendors and offered the following
assistance: