SQL 101.

Slides:



Advertisements
Similar presentations
What is a Database By: Cristian Dubon.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Virtual training week 4 structured query language (SQL)
Structured Query Language and its components. SQL SQL stands for Structured Query Language. There is a standard SQL called the American National Standards.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 2 Structured Query Language.
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
Information Resources Management March 6, Agenda n Administrivia n SQL Part 2 n Homework #6.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
Database Technical Session By: Prof. Adarsh Patel.
Introduction to SQL Steve Perry
I Copyright © Oracle Corporation, All rights reserved. Introduction.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
University of Sunderland COM 220Lecture Two Slide 1 Database Theory.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Quick review of SQL And conversion to Oracle SQL.
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Database Programming Sections 14– database transactions and controlling User Access.
DBMS_Week 3-4 DBMS. Three-Schema Architecture – Internal schema (one view) describes physical storage structures access paths, indexes used Typically.
Retrieving Data in PL/SQL. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Recognize the SQL statements that can.
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
1 Announcements Reading for next week: Chapter 4 Your first homework will be assigned as soon as your database accounts have been set up.  Expect an .
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Chapter 3: Relational Databases
Oracle 10g Database Administrator: Implementation and Administration Chapter 10 Basic Data Management.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
 CONACT UC:  Magnific training   
SQL Basics Review Reviewing what we’ve learned so far…….
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
Oracle sql Online Training By SMART MIND ONLINE TRAINING Website:
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Understanding Core Database Concepts Lesson 1. Objectives.
Fundamentals of DBMS Notes-1.
Structured Query Language
SQL Query Getting to the data ……..
Relational Model.
The Basics of Data Manipulation
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Introduction To Database Systems
Applied CyberInfrastructure Concepts Fall 2017
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
“Introduction To Database and SQL”
Structured Query Language (SQL) William Klingelsmith
DATABASE MANAGEMENT SYSTEM
Accounting System Design
Chapter 8 Working with Databases and MySQL
The Basics of Data Manipulation
مقدمة في قواعد البيانات
SQL Fundamentals in Three Hours
Accounting System Design
SQL .. An overview lecture3.
Computer Science Projects Database Theory / Prototypes
Contents Preface I Introduction Lesson Objectives I-2
Chapter # 7 Introduction to Structured Query Language (SQL) Part I.
DATABASE Purpose of database
Understanding Core Database Concepts
Lecuter-1.
INTRODUCTION A Database system is basically a computer based record keeping system. The collection of data, usually referred to as the database, contains.
Presentation transcript:

SQL 101

Fast and furious 7 classes, one hour in length Homework? Let’s talk Oracle SQL exam Too hard?

Code examples will come from This book:

Database Checkout: Can you login? Install the STUDENT schema: \\newmoon\public\SQL_101 Online Reference: \\newmoon\public\SQL_101\Oracle10g_Comp_Ref\book.pdf

Examples: Syntax:

Relational Database Management System (RDBMS): An RDBMS typically contains data in tables, essentially a two-dimensional matrix consisting of columns and rows. Tables: A table typically contains data about a single subject. Each table has a unique name that signifies the contents of the data. Columns: Columns in a table organize the data further. Each column represents a single, low-level detail about a particular set of data. The name of the column is unique within a table and identifies the data you find in the column. Rows: Each row usually represents one unique set of data within a table. Each intersection of a column and row in a table represents a value, and some do not which are said to be null. Null is an unknown value… it cannot be evaluated or compared because a null is unknown.

Column Row

Primary Key: The purpose of the primary key (PK) is to uniquely identify data within a table. A table may have only ONE PK which consists of one or more columns. If the PK contains multiple columns, it is referred to as a composite primary key. Oracle does not require every table to have a PK, however, it is strongly recommended. Foreign Keys: If you store students and the students zip code information in one table, each student’s name would have the address information (zip, city, state) repeated for each student in that zip code. If however, the data is split into two tables (STUDENT & ZIPCODE), then when an update is made to the location of the student, only one column needs to be updated vice 3. Eliminating redundancy is one of the key concepts in relational databases and this process is called normalization. The foreign key column (ZIP) happens to have the same column name in the STUDENT table. This makes it easier to recognize the fact that the tables share common column values… this the preferred method, but not mandatory.

Primary Key

Foreign Key

What is SQL? An acronym for Structured Query Language Pronounced “sequel” It is the primary interface with the database and it’s commands allow you to query, insert, update, and delete data. DML: Data Manipulation Language (Insert, Update, Merge & Delete data) DDL: Data Definition Language (Create, Alter, Drop, Truncate & Rename) DCL: Data Control Language (Grant, Revoke) Transaction Control: Commit, Rollback, Savepoint

Capabilities of a SQL SELECT statement: A SELECT statement retrieves information from the database. You can do the following when using a SELECT statement: Projection: You can use the projection capability in SQL to choose the columns in a table that you want returned by your query Selection: You can use the selection capability in SQL to choose the rows in a table that you want returned by a query Joining: You can use the join capability in SQL to bring together data that is stored in different tables by creating a link between them

So…. Using SQL, how would I see all the data in the COURSE table?

So…. Using SQL, how would I see all the data in the COURSE table? SQL> select * from course;

How to limit the rows returned by your query: Query the COURSE table and return the rows with a cost of 1095 only

How to limit the rows returned by your query: Query the COURSE table and return the rows with a cost of 1095 only Use the WHERE clause (otherwise known as the “predicate”)

How to sort the rows returned by your query: Query the COURSE table and sort the rows by COURSE_NO

How to sort the rows returned by your query: Query the COURSE table and sort the rows by COURSE_NO Now, reverse the order of the sort

How to sort the rows returned by your query: Query the COURSE table and sort the rows by COURSE_NO Now, reverse the order of the sort

Using variables in your SQL statement: