1 / 18

Chapter 1 : Introduction

Chapter 1 : Introduction. BORDOLOI & BOCK . SQL. SQL, pronounced ‘Sequel’ or simply S-Q-L, is a computer programming language that was developed especially for querying relational databases using a non-procedural approach.

denna
Download Presentation

Chapter 1 : Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1 : Introduction BORDOLOI & BOCK

  2. SQL • SQL, pronounced ‘Sequel’ or simply S-Q-L, is a computer programming language that was developed especially for querying relational databases using a non-procedural approach. • The term non-procedural means that you can extract information by simply telling the system what information is needed without telling how to perform the data retrieval. The RDBMS parses (converts) the SQL commands and completes the task.

  3. SQL • Extracting information from the database by using SQL is termed querying the database. • SQL is a language that is fairly simple to learn, in terms of writing queries but it has considerable complexity because it is a very powerful language.

  4. DATA AND INFORMATION • Information is derived from raw facts known as data. • Data has little meaning or usefulness to managers unless it is organized in some logical manner. • One of the most efficient ways to organize and manage data is through the use of database management system (DBMS).

  5. DATA • Two types of data are stored within a database • User data : Data that must de stored by an organization. • System data: Data the database needs to manage user data to manage itself. This is also termed metadata, or the data about data.

  6. SQL • Data is manipulated by RDBMS users through the use of special data manipulation language. • Database structures can also be defined by the use of data definition language. • SQL is the most popular database language and has commands that enable it to be used for both manipulation and definition of databases.

  7. SQL • SQL is used by Oracle for all interaction with the database. SQL statements fall into the two major categories • Data Definition Language(DDL) : Set of SQL commands that create and define objects in a database • Data Manipulation Language(DML) : Set of SQL commands that allow users to manipulate the data in a database.

  8. SQL • SQL is basically a free format language. This means that there are no particular spacing rules that must be followed when typing SQL commands. • In Oracle, you must end each individual SQL statement (irrespective of whether it is composed as a single or multiple lines of code) with a semi-colon (;). It is the “;” which ends an SQL statement and tellls Oracle to Execute it.

  9. RELATIONAL OPERATIONS • SQL operations for creating new tables, inserting table rows , updating table rows, deleting table rows, and querying databases are the primary means of interfacing with relational databases. • The SELECT statement is used primarily to write queries that extract information from the database which is a collection of related tables.

  10. Starting Oracle SQL*PLUS • The most common types used are either the standard Oracle SQL*PLUS available for a Windows-type interface or by connecting to an Oracle database via a telnet session. • The following Log On session is a connection to an Oracle database stored on a Sun Microsystems server running the Unix O/S. • A SQL*PLUS session is begun by typing the command sqlplus at the command prompt($) and entering the username and password information . contd

  11. Log On Screen

  12. Exiting SQL*PLUS • The SQL*PLUS session can be ended by typing a command at the SQL prompt to terminate the session. • Two commands are available: exit or quit. Either one of these can be used to terminate a SQL*PLUS session.

  13. Running (Executing) a Command File • The command to run (execute) a command file is: SQL> START filename.sql • A form of shorthand for the word “start” can be used when executing a command file by replacing “start” with the @ (“at” symbol).

  14. Syntax Conventions • Each select statement must follow precise syntactical and structural rules. • The following is the minimum structure and syntax required for an SQL SELECT statement. SELECT [DISTINCT | ALL] {* | select_list} FROM {table_name [alias] | view_name}

  15. SQL Keywords • Keywords are words that have a predefined meaning in SQL. • In practice, keywords may be entered in upper or lower case letters. SELECT * FROM employee; select * from employee;

  16. SQL Keywords • In some cases keywords can be abbreviated. • The allowed abbreviation is shown in upper case letters with the remainder shown in lower case, which means either the full word or only the upper case part can be used. DESCribe: can be entered as either DESC or DESCRIBE.

  17. SQL Naming Conventions • Identifiers are the names given by information system developers or system users to database objects such as tables , columns, indexes, and other objects as well as the database itself. • There are several rules for naming database objects that must be followed. • Identifiers should contain between 1 and 30 characters. • The first character must be either alphabetic (a-z, A-Z) or the @ symbol or _ (underscore).

  18. SQL Naming Conventions • After the first character, digits, letters, or the symbols $,#, or _(underscore) must be used. • No embedded spaces are allowed in identifiers. • SQL keywords cannot be used as an identifier.

More Related