I have already earned $35 within month spending few minutes only

Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Saturday, December 12, 2009

Exam : Oracle 1Z0-007 practice questions

Exam : Oracle 1Z0-007
Title : Introduction to Oracle9i: SQL questions and practice sure pass


1. In which three cases would you use the USING clause? (Choose three.)
A.You want to create a nonequijoin.
B.The tables to be joined have multiple NULL columns.
C.The tables to be joined have columns of the same name and different data types.
D.The tables to be joined have columns with the same name and compatible data types.
E.You want to use a NATURAL join, but you want to restrict the number of columns in the join condition.
Answer: CDE

2. What are two reasons to create synonyms? (Choose two.)
A.You have too many tables.
B.Your tables are too long.
C.Your tables have difficult names.
D.You want to work on your own tables.
E.You want to use another schema's tables.
F.You have too many columns in your tables.
Answer: CE

3. The STUDENT_GRADES table has these columns:
STUDENT_ID NUMBER(12)
SEMESTER_END DATE
GPA NUMBER(4,3)
The registrar requested a report listing the students' grade point averages (GPA) sorted from highest grade point average to lowest.
Which statement produces a report that displays the student ID and GPA in the sorted order requested by the registrar?
A.SELECT student_id, gpa
FROM student_grades
ORDER BY gpa ASC;
B.SELECT student_id, gpa
FROM student_grades
SORT ORDER BY gpa ASC;
C.SELECT student_id, gpa
FROM student_grades
SORT ORDER BY gpa;
D.SELECT student_id, gpa
FROM student_grades
ORDER BY gpa;
E.SELECT student_id, gpa
FROM student_grades
SORT ORDER BY gpa DESC;
F.SELECT student_id, gpa
FROM student_grades
ORDER BY gpa DESC;
Answer: F

4. The CUSTOMERS table has these columns:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)
The CUSTOMER_ID column is the primary key for the table.
You need to determine how dispersed your customer base is. Which expression finds the number of different countries represented in the CUSTOMERS table?
A.COUNT(UPPER(country_address))
B.COUNT(DIFF(UPPER(country_address)))
C.COUNT(UNIQUE(UPPER(country_address)))
D.COUNT DISTINCT UPPER(country_address)
E.COUNT(DISTINCT (UPPER(country_address)))
Answer: E

5. What does the FORCE option for creating a view do?
A.creates a view with constraints
B.creates a view even if the underlying parent table has constraints
C.creates a view in another schema even if you don't have privileges
D.creates a view regardless of whether or not the base tables exist
Answer: D

Oracle 9i introduction


Oracle 9i introduction video

Oracle 9i presentation


Oracle 9i presentation

Friday, December 4, 2009

Query Analysis and Optimizing in Oracle

Query Analysis and Optimizing in Oracle

Introduction to Oracle 9i: SQL

  

Oracle 9i DBA Track-4 Exams

OCA

Exam #1Z0-007 Introduction to Oracle 9i: SQL

Exam #1Z0-031- Oracle 9i Database Fundamentals I

OCP

Exam #1Z0-032- Oracle 9i Database Fundamentals II

Exam #1Z0-033- Oracle 9i Database: Performance Tuning

Introduction to Oracle 9i: SQL

Writing Basic SQL Select statements

List the capabilities of SQL SELECT statements

Execute a basic SELECT statement

Differentiate between SQL statements and SQL *Plus commands

Restricting and sorting Data

Limit the rows retrieved by a query

Sort the rows retrieved by a query

Single Row Functions

Describe various types of functions available in SQL

Use character, number and date functions in SELECT statements

Use conversion functions

Displaying data from multiple tables

Write SELECT statements to access data from more than one table using equality and non-equality joins

View data that generally does not meet a join condition by using outer joins

Join a table to it-self using a self-join

Aggregating data using group functions

Identify the available group functions

Use group functions

Group data by using the GROUP BY functions

Include or exclude grouped rows by using the HAVING clause

Sub queries

Describe the types of problems that sub-queries can solve

Define subqueries

List the types of subqueries

Write single row and multiple rows subquries

Producing Readable output with iSQL*Plus

Produce queries that require a substitution variable

Produce more readable output

Create and execute script files

Manipulating data

Describe each DML statement

Insert rows into a table

Update rows from a table

Delete rows from a table

Merge rows from a table

Control transactions

Creating and managing tables

Describe the main database objects

Create tables

Describe the data types that can be used when specifying column definition

Alter table definitions

Drop, rename ad truncate tables

Including constraints

Describe constraints

Create and maintain constraints

Creating views

Describe a view

Create, alter the definition and drop a view

Retrieve data through a view

Insert update and delete data through a view

Create and use an inline view

Perform TOP ‘N’ Analysis

Creating other database objects

Create, maintain and use sequences

Create and maintain indexes

Create private and public synonyms

Controlling user access

Create users

Create roles to ease setup and maintenance of the security model

Use the GRANT and REVOKE statements to grant and revoke object privileges















how to communicate any ug general 8 i learn dj workshop how technology co key functions instructor up business and IT pattern security internet and awk mining synthesis joins effects cs3 training module 2 14 hours Build it com project canadian Made sap is if required reports 8 ms windows network hr new no.3 ladder safety design- sumif communication skills the company microsoft NT over 20 release 11 5 cross culture april 6th p2 foundation Pentium payroll and accounts Creative and innovation we complete tips of dreamweaver 40 their take the class datawarehouse the training any other Lean 5s drawing quality a it organization s not 0 system organization s enable it IS STANDARDS keep you from expectations body s 25 years t find open source technologies how to do personal trainer bd software the quality management 3 levels help prepare you job server Imap4 ba analysis Filmmaking form validation ecc programs the design requirement are being focus how georgia management boston 4 week Supervisory Management the needs the delivery of advanced lr life and health CE the processes The Formatting Toolbars arena use of -- manual Phi what are your support training emulator nt tools PLC CCNA Oracle Java QTP excel software testing CPR english quickbooks IATA MCSE networking computer AutoCAD management informatica electrical Tally forklift ABAP hvac safety scada pds piping Finance ITIL project management spoken english acls PHP communication insurance sas pmp embedded siebel ERP peoplesoft pdms soft skills welding telecom marketing animation AS400 train the trainer fico photoshop payroll phlebotomy six sigma Cognos J2EE UNIX asp net chennai sap fico solidworks electronics housekeeping plumbing CCNP free anger management vlsi mortgage matlab personality development gsm bookkeeping banking nursing hardware plastering first aid sharepoint american heart association cpr dot net Ndt embedded systems NLP software ielts Cisco Flash OSHA aix Powerpoint mobile dba Design access business objects Oracle Dba engineering india data warehousing db2



Wednesday, December 2, 2009

Comparison Conditions

Comparison Conditions

=

>

>=

<

<=

<>

BETWEEN…AND…

IN(set)

LIKE

IS NULL

We can display rows based on a range of values using the BETWEEN range condition. The range that we specify contains a lower limit and an upper limit.

To test for values in a specified set of values, use the IN condition. The IN condition is also known as the membership condition.

We may not always know the exact value to search for. We can select rows that match a character pattern by using the LIKE condition. The character pattern-matching operation is referred to as a wildcard search. Two symbols can be used to construct the search string. Ie. %(zero or more characters) and _ (single character).

The NULL conditions include the IS NULL condition and the IS NOT NULL condition. The IS NULL condition tests for nulls. A null value means the value is unavailable, unassigned, unknown, or inapplicable. Therefore, we cannot test with = because a null cannot be equal or unequal to any value.

- select empno, ename,job, deptno from emp where deptno=20;

- select empno, ename, salary from emp where lastname=’Lama’;

- select * from emp where hiredate=’01-JAN-95’ and salary>=5000 and lastname=’Smith’;

- select ename,slary from emp where salary between 2300 and 3500;

- select empno,ename,salary,mgr from emp where deptno in(20,30,40);

- select ename,hiredate from emp where hiredate like ‘%95’;

- select ename from emp where ename like ‘_e%’;

- select ename,mgr from emp where mgr is null;

- select ename,salary,comm. from emp where comm. is null;

- select empno, ename,job,salary from emp where salary>=1000 and job like ‘SYS%’;

- select empno, ename,job,salary from emp where salary>=1000 or job like ‘SYS%’;

- select empno, ename from emp where job in (‘MANAGER’, ‘CLERK’, ‘PEON’);

The order of rows returned in a query result is undefined. The ORDER BY clause can be used to sort the rows. If we use the ORDER BY clause, it must be the last clause of the SQL statement. We can specify an expression, or an alias, or column position as the sort condition. Syntax:

SELECT expression

FROM table

WHERE conditions

ORDER BY columns [ASC|DESC];

If the ORDER BY clause is not used, the sort order is undefined, and the oracle server may not fetch rows in the same order for the same query twice. Use the ORDER BY clause to display the rows in a specific order.

To reverse the order in which rows are displayed, specify the DESC keyword after the column name in the ORDER BY clause.

- select ename, job, depatno, hiredate from emp order by hiredate;

- select ename, job ,deptno, hiredate from emp order by hiredate desc;

- select empno, ename, salary, salry*12 Annsal from emp order by annsal;

- select ename, deptno, salary from emp order by deptno,salary desc;

Primary key constraints

Primary key constraints

This constraint avoids duplication of rows and does not allow NULL values, when enforced in a column or set of columns. A a result it is used to identify a row. A table can have only one primary key. If a primary key constraint is assigned to more than one column(i.e) or combination of columns it is said to be a composite primary key (or simply a composite key), which can contain a maximum of 16 columns. Primary key constraint cannot be defined in an alter table command when the table contains rows having NULL values.

Run and Check your out put

- select * from emp;

- select deptno, dname, loc from dept;

- select empno, ename, salary, hiredate from emp;

- select ename,salary, salary+100 from emp;

- select ename, salary, (salary*12)+100 from emp;

- select ename,slary, (salary*12)+comm. from emp;

- select ename,salary, (salary*12)+nvl(comm,0) from emp;

- select ename “Full Name”, salary*12 “Annual Salary” from emp;

- select ename||job from emp;

- select ename||’ is a ‘||job “Emp Detail” from emp;

- select deptno from emp;

- select distinct deptno from emp;

- select distinct deptno, job from emp;

- In SQL, we can display the structure of a table using the DESCRIBE command. The command shows the column names and data types, as well as whether a column must contain data or not.

- desc emp;

- describe emp;

Wednesday, November 25, 2009

An A-Z Index of the SQL Server 2005 database

An A-Z Index of the SQL Server 2005 database
Aggregate
- CREATE AGGREGATE
- DROP AGGREGATE
Application Role
- CREATE APPLICATION ROLE
- ALTER APPLICATION ROLE
- DROP APPLICATION ROLE
Assembly
- CREATE ASSEMBLY
- ALTER ASSEMBLY
- DROP ASSEMBLY

ALTER AUTHORIZATION

BACKUP
BACKUP CERTIFICATE
BEGIN [DIALOG [CONVERSATION]]

Certificate - ALTER CERTIFICATE
- CREATE CERTIFICATE
- DROP CERTIFICATE
CHECKPOINT
COMMIT
Contract - CREATE CONTRACT
- DROP CONTRACT
Credential - CREATE CREDENTIAL
- ALTER CREDENTIAL
- DROP CREDENTIAL

Database - CREATE DATABASE
- ALTER DATABASE
- DROP DATABASE
DBCC CHECKALLOC - Check consistency of disk allocation.
DBCC CHECKCATALOG - Check catalog consistency
DBCC CHECKCONSTRAINTS - Check integrity of table constraints.
DBCC CHECKDB - Check allocation, and integrity of all objects.
DBCC CHECKFILEGROUP - Check all tables and indexed views in a filegroup.
DBCC CHECKIDENT - Check identity value for a table.
DBCC CHECKTABLE - Check integrity of a table or indexed view.
DBCC CLEANTABLE - Reclaim space from dropped variable-length columns.
DBCC dllname - Unload a DLL from memory.
DBCC DROPCLEANBUFFERS - Remove all clean buffers from the buffer pool.
DBCC FREE... CACHE - Remove items from cache.
DBCC HELP - Help for DBCC commands.
DBCC INPUTBUFFER - Display last statement sent from a client to a database instance.
DBCC OPENTRAN - Display information about recent transactions.
DBCC OUTPUTBUFFER - Display last statement sent from a client to a database instance.
DBCC PROCCACHE - Display information about the procedure cache
DBCC SHOW_STATISTICS - Display the current distribution statistics
DBCC SHRINKDATABASE - Shrink the size of the database data and log files.
DBCC SHRINKFILE - Shrink or empty a database data or log file.
DBCC SQLPERF - Display transaction-log space statistics. Reset wait and latch statistics.
DBCC TRACE... - Enable or Disable trace flags
DBCC UPDATEUSAGE - Report and correct page and row count inaccuracies in catalog views
DBCC USEROPTIONS - Return the SET options currently active
DBCC deprecated commands
DECLARE
Default - CREATE DEFAULT
- DROP DEFAULT
DELETE
DENY - DENY Object permissions
- DENY User/Role permissions
Endpoint - CREATE ENDPOINT
- ALTER ENDPOINT
- DROP ENDPOINT
Event - CREATE EVENT NOTIFICATION
- DROP EVENT NOTIFICATION
EXECUTE
EXECUTE AS

Fulltext Catalog - CREATE FULLTEXT CATALOG
- ALTER FULLTEXT CATALOG
- DROP FULLTEXT CATALOG
Fulltext Index - CREATE FULLTEXT INDEX
- ALTER FULLTEXT INDEX
- DROP FULLTEXT INDEX
Function - CREATE FUNCTION
- ALTER FUNCTION
- DROP FUNCTION

GO
GRANT - GRANT Object permissions
- GRANT User/Role permissions

Index - CREATE INDEX
- ALTER INDEX
- DROP INDEX
INSERT
iSQL -U user -P password -i script.sql -o logfile.log

Key - CREATE ASYMMETRIC KEY - ALTER ASYMMETRIC KEY
- DROP ASYMMETRIC KEY
- CREATE SYMMETRIC KEY
- OPEN SYMMETRIC KEY - CLOSE SYMMETRIC KEY
- ALTER SYMMETRIC KEY
- DROP SYMMETRIC KEY
KILL
KILL QUERY NOTIFICATION
KILL STATS JOB

Login - CREATE LOGIN
- ALTER LOGIN
- DROP LOGIN

Master Key - CREATE MASTER KEY
- ALTER MASTER KEY - BACKUP MASTER KEY
- DROP MASTER KEY
- RESTORE MASTER KEY
- ALTER SERVICE MASTER KEY - BACKUP SERVICE MASTER KEY
- RESTORE SERVICE MASTER KEY
Message Type - CREATE MESSAGE TYPE
- ALTER MESSAGE TYPE
- DROP MESSAGE TYPE

Partition Function - CREATE PARTITION FUNCTION
- ALTER PARTITION FUNCTION
- DROP PARTITION FUNCTION
Partition Scheme - CREATE PARTITION SCHEME
- ALTER PARTITION SCHEME
- DROP PARTITION SCHEME
Procedure - CREATE PROCEDURE
- ALTER PROCEDURE
- DROP PROCEDURE

Queue - CREATE QUEUE
- ALTER QUEUE
- DROP QUEUE

Remote Service Binding - CREATE REMOTE SERVICE BINDING
- ALTER REMOTE SERVICE BINDING
- DROP REMOTE SERVICE BINDING

RESTORE - RESTORE DATABASE Complete
RESTORE DATABASE Partial
RESTORE DATABASE Files
RESTORE LOGS
RESTORE DATABASE_SNAPSHOT
RESTORE FILELISTONLY - List database and log files
RESTORE HEADERONLY - List backup header info
RESTORE LABELONLY - Media info
RESTORE REWINDONLY - Rewind and close tape device
RESTORE VERIFYONLY
REVERT
REVOKE - REVOKE Object permissions
- REVOKE User/Role permissions
Role - CREATE ROLE
- ALTER ROLE
- DROP ROLE
ROLLBACK
Route - CREATE ROUTE
- ALTER ROUTE
- DROP ROUTE

Schema - CREATE SCHEMA
- ALTER SCHEMA
- DROP SCHEMA
SELECT
SEND
SERVERPROPERTY
Service - CREATE SERVICE
- ALTER SERVICE
- DROP SERVICE
SESSION_USER
SESSIONPROPERTY
SET @local_variable
SET
SHUTDOWN
Signature - ADD SIGNATURE
- DROP SIGNATURE
Statistics - CREATE STATISTICS
- UPDATE STATISTICS
- DROP STATISTICS

Synonym - CREATE SYNONYM
- DROP SYNONYM

Table - CREATE TABLE
- ALTER TABLE
- DROP TABLE
- TRUNCATE TABLE
Transaction - BEGIN DISTRIBUTED TRANSACTION
- BEGIN TRANSACTION
- COMMIT TRANSACTION
Trigger - CREATE TRIGGER
- ALTER TRIGGER - ENABLE TRIGGER - DISABLE TRIGGER
- DROP TRIGGER
Type - CREATE TYPE
- DROP TYPE

UNION
UPDATE
User - CREATE USER
- ALTER USER
- DROP USER
USE

View - CREATE VIEW
- ALTER VIEW
- DROP VIEW

XML Schema Collection - CREATE XML SCHEMA COLLECTION
- ALTER XML SCHEMA COLLECTION
- DROP XML SCHEMA COLLECTION

Tuesday, November 24, 2009

Serializing Data Structures

Serializing Data Structures

Arbitrary data structures can be serialized by using the member functions CArchive::Write and CArchive::Read. Each of these functions takes as parameters a pointer to a buffer and the number of bytes to transfer. The following code example uses these functions to serialize a LOGFONT data structure:

void CMyFont::Serialize(CArchive& ar)
{
LOGFONT logfont;
if (ar.IsStoring())
{
// call user function to initialize the structure.
InitLogFont(&logfont);
ar.Write(&logfont, sizeof(logfont));
}
else
{
ar.Read(&logfont, sizeof(logfont));
// call user function to save the structure.
SaveLogFont(&logfont);
}
}

Serializing Class Objects
Class objects can be serialized if they have been derived from CObject and have overridden the Serialize member function. For example, many of the MFC collection classes override this function for you. To serialize a document that contains such an object, call the Serialize function of the member directly.


Making a Serializable Class
You can implement object persistence for any class by adding serialization support for that class. You add this support by first declaring the class as serializable and then implementing the necessary serialization code.


To make a serializable class

1. Publicly derive the class from CObject or from a class that was derived from CObject.
2. In the class declaration, provide a default constructor. The framework requires a default constructor (a constructor with no arguments) to create objects when loading data from a data file. If you use ClassWizard to add a new class, it will automatically add a default constructor.
3. In the class declaration, add the DECLARE_SERIAL macro. Provide the class name as the single argument.
4. In the implementation file, add the IMPLEMENT_SERIAL macro. The three parameters to IMPLEMENT_SERIAL are the class being serialized, its base class, and a schema number.
5. Override the CObject::Serialize function. This is easily done by right-clicking the class name in ClassView and then selecting the menu item Add Virtual Function.


To see sample code that declares a serializable class, click this icon.

// Serializ.h - header file

// Publicly derive the class from CObject
class CSerializedPhrase : public CObject
{
protected:
// Provide a default constructor
CSerializedPhrase();
public:
// Override Serialize
void Serialize(CArchive &);
// Invoke the DECLARE_SERIAL macro
DECLARE_SERIAL(CSerializedPhrase)
...
};

To see sample code that implements serialization for a class, click this icon.

// Serializ.cpp - implementation file
IMPLEMENT_SERIAL(CSerializedPhrase, CObject, 1)
CSerializedPhrase::CSerializedPhrase()
{

}
void CSerializedPhrase::Serialize(CArchive & ar)
{
// The base function is called first.
CObject::Serialize(ar);
if (ar.IsLoading())
ar >> m_phrase >> m_location >> m_color;
else
ar << m_phrase << m_location << m_color;
}

Using a Serializable Class
How you use a serializable class depends upon whether you are working with an object of the serializable class or a pointer to an object of the serializable class. This topic also covers how to handle issues of schema numbering both in the serializable class and in the document class.

Serializing Objects
If your document class uses your serializable class as an embedded member, you can invoke the Serialize method directly, as shown in the following example code:

class CPhraseDoc : public CDocument
{
...
// Define a CSerializedPhrase object
CSerializedPhrase m_Phrase;
...
}
// CPhraseDoc.cpp implementation file
void CPhraseDoc::Serialize(CArchive& ar)
{
m_Phrase.Serialize(ar);
}

Serializing Objects via Pointers

Using a pointer for the serializable object has its own set of considerations. How you handle the serialization depends upon whether or not the pointer was initialized.

Deserializing to Uninitialized Object Pointers

If the class contains an uninitialized object pointer, then you should rely on the extraction and insertion operators (>> and <<) for serialization of the object. In the case of reading from the data file, the archive object will build the object using its default constructor and then call the object's Serialize function. As an alternative, you can explicitly construct the object pointer and then call the Serialize function. To see sample code that uses the archive to handle memory allocation when you deserialize an object, click this icon.

// PhrasDoc.h
class CPhraseDoc : public CDocument
{
...
// Define a CSerializedPhrase pointer
CSerializedPhrase * m_pPhrase;
...
}
// PhrasDoc.cpp
CPhraseDoc :: CPhraseDoc()
:m_pPhrase(0)
{

}
void CPhraseDoc::Serialize(CArchive& ar)
{
if (ar.IsLoading())
ar >> m_pPhrase;
else
ar << m_pPhrase;
}
BOOL CPhraseDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
m_pPhrase = new CSerializedPhrase;
// fill object as appropriate
return TRUE;
}
void CPhraseDoc::DeleteContents()
{
delete m_pPhrase;
m_pPhrase = 0;
CDocument::DeleteContents();
}

Deserializing to Initialized Object Pointers

If the object pointer is already initialized, then you can use either the extraction and insertion operators (>> and <<), or you can call the object's Serialize function directly. What is important is that you make sure that the object cleans up its data members before deserializing from the data file. Not adhering to this rule will generate memory leaks in your application. Cleaning up an object's data members is often done by calling a user-defined member function that frees memory allocated from the heap.

The document object provides a convenient place for deleting its contents in the CDocument::DeleteContents member function. The MFC framework is structured so that it will call this function when a document is to be reused or destroyed. A useful strategy is to create a DeleteContents member function for each serialized class that you create and then have each object call the DeleteContents function of each of its contained objects. Since the framework calls the document's DeleteContents member function, the entire document will be efficiently and correctly deleted.


Whichever method you decide to use, you must be consistent. Use the same method — either the Serialize function or the CArchive << and >> operators — for both the loading and storing of any one object.