+ All Categories
Home > Documents > GOURAV 97-03

GOURAV 97-03

Date post: 10-Apr-2018
Category:
Upload: nitinpunyani
View: 225 times
Download: 0 times
Share this document with a friend

of 22

Transcript
  • 8/8/2019 GOURAV 97-03

    1/22

    Submitted by:

    GOURAV

    GOYAL1608033

    C.S.E. (3rdyear)

    Submitted to:

    AMAN

    NEHRA(Training

    Incharge)

  • 8/8/2019 GOURAV 97-03

    2/22

    SQL is a standard language for accessing andmanipulating databases.

    y SQL stands for Structured Query Language

    y SQL lets you access and manipulate databases

    y SQL is an ANSI (American National StandardsInstitute) standard

  • 8/8/2019 GOURAV 97-03

    3/22

    y SQL can execute queries against a database

    y SQL can retrieve data from a database

    y SQL can insert records in a database

    y SQL can update records in a database

    y SQL can delete records from a database

    y SQL can create new databases

    y SQL can create new tables in a database

    y SQL can create stored procedures in a database

    y SQL can create views in a database

    y SQL can set permissions on tables, procedures,and views

  • 8/8/2019 GOURAV 97-03

    4/22

    The first thing you need to understand about SQL isthat it isnt a procedural language like FORTRON,BASIC, C, COBOL, Pascal or Ada. To solve a problem

    in one of th

    ose languages, you write a procedure th

    atperforms one operation after another until the task iscomplete.

    SQL is nonprocedural. To solve a problem with SQL,instead of telling the system how to get you what youwant, you simply tell it what you want. The DBMSdecides the best way to get you what you asked for.

  • 8/8/2019 GOURAV 97-03

    5/22

    Interactive Easy Portable

    HighLevelVendorIndependent

  • 8/8/2019 GOURAV 97-03

    6/22

    y RDBMS stands forRelational Database ManagementSystem.

    y RDBMS is the basis for SQL, and for all moderndatabase systems likeMS SQL Server, IBMDB2,Oracle, My SQL, and Microsoft Access.

    y The data in RDBMS is stored in database objects

    called tables.

    y A table is a collections of related data entries and itconsists of columns and rows.

  • 8/8/2019 GOURAV 97-03

    7/22

    The OracleDatabase (commonly referred to asOracle RDBMSor simply as Oracle) is a relationaldatabase management system (RDBMS) producedand marketed by Oracle Corporation.

    The name Oracle comes from the code-name of aCIA-funded project.

    In 2003, Oracle Corporation released OracleDatabase 10g, which supported regularexpressions. (The g stands for "grid"; emphasizinga marketing thrust of presenting 10g as "grid

    computing ready".

  • 8/8/2019 GOURAV 97-03

    8/22

  • 8/8/2019 GOURAV 97-03

    9/22

    A SELECT statement retrieves information from thedatabase. Its capabilities are:

    y Projection: Choose the columns in a table that arereturned by a query.

    y Selection: Choose the rows in a table that are

    returned by a query.

    y Joining: Bring together data that is stored in differenttables by specifying the link between them.

  • 8/8/2019 GOURAV 97-03

    10/22

    When retrieving the data from the database, youmay need to do the following:

    y Restrict the rows of data that are displayed.y Specify the order in which rows are displayed.

    There are SQL statements that you use to perform theseactions.

  • 8/8/2019 GOURAV 97-03

    11/22

    Using theWHERE Clause

  • 8/8/2019 GOURAV 97-03

    12/22

    Using the ORDERBYClause

  • 8/8/2019 GOURAV 97-03

    13/22

    Functions are very powerful features of SQL. Theycan be used to do the following:

    y

    Perform calculations on datay Modify individual data items

    y Manipulate output for groups of rows

    y Formats dates and numbers for display

    y

    Convert column data types

    SQL functions always return a value.

  • 8/8/2019 GOURAV 97-03

    14/22

    FUNCTIONS

    Single-rowFunctions

    Multiple-rowFunctions

  • 8/8/2019 GOURAV 97-03

    15/22

    What are Group Functions?

    Group functions operate on sets of rows to give oneresult per group.

    These sets may comprise the entire table or the table

    split into groups.

  • 8/8/2019 GOURAV 97-03

    16/22

    AJoin is used to view information from multiple tables.Therefore, you can join tables together to viewinformation from more than one table.

    Eg.:y Employee IDs exist in EMPLOYEES tabley Department IDs exist in both the EMPLOYEES &

    DEPARTMENTS tablesy Department names exist in DEPARTMENTS table

    To produce the report you need to link the EMPLOYEES &DEPARTMENTS tables.

  • 8/8/2019 GOURAV 97-03

    17/22

    Cross Joins Natural

    Joins

    USINGClause FULL OuterJoins

  • 8/8/2019 GOURAV 97-03

    18/22

    Using a subquery to solve a problem

    Suppose you want to write a query to find out who earns

    a salary greater th

    an Abels salary.To solve this problem you need two queries: one to findhow muchAbel earns, & a second query to find whoearns more than that amount.

    You can solve this problem by placing one query insidethe other.

    The inner query (subquery) returns a value that is usedby the outer query (main query).

  • 8/8/2019 GOURAV 97-03

    19/22

    Return only one row

    from inner SELECT

    statement

    Return more than one

    row from inner SELECT

    statement

    Single-rowSubqueries

    Multiple-row

    Subqueries

  • 8/8/2019 GOURAV 97-03

    20/22

    Set operators combine the results of two ormore component queries into one result

  • 8/8/2019 GOURAV 97-03

    21/22

    UNION-All distinct rows selected by either query

    UNIONALL-All rows selected by either query,

    including all duplicates

    INTERSECT- All distinct rows selected by bothqueries

    MINUS-All distinct rows that are selected by the firstSELECT statement and not selected in second SELECTstatement

  • 8/8/2019 GOURAV 97-03

    22/22

    THANKS


Recommended