1.NET Web Forms Database Queries © 2002 by Jerry Post.

Slides:



Advertisements
Similar presentations
SQL Rohit Khokher.
Advertisements

Virtual training week 4 structured query language (SQL)
1 Materi Pendukung Pertemuan > Transaksi pendukung pada SQL Matakuliah: >/ > Tahun: > Versi: >
Database Systems: Design, Implementation, and Management Tenth Edition
1 Copyright © 2010 Jerry Post with additions & narration by M. E. Kabay. All rights reserved. Advanced Queries IS240 – DBMS Lecture # 8 – M.
Introduction to Structured Query Language (SQL)
5 Chapter 5 Structured Query Language (SQL2) Revision.
Introduction to Structured Query Language (SQL)
DATABASE APPLICATION DEVELOPMENT SAK 3408 Query Statements.
Chapter 3: Using SQL Queries to Insert, Update, Delete, and View Data
Introduction to Structured Query Language (SQL)
Jerry Post McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Database Management Systems Chapter 4 Data Queries.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Introduction to SQL J.-S. Chou Assistant Professor.
Jerry Post Copyright © Database Management Systems Chapter 4 Queries.
Introduction to DBMS and SQL Introduction to DBMS and SQL GUIDED BY : MR. YOGESH SAROJ (PGT-CS) MR. YOGESH SAROJ (PGT-CS) Presented By : JAYA XII –COM.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Chapter 4 Querying Based on G. Post, DBMS: Designing & Building Business Applications University of Manitoba Asper School of Business 3500 DBMS Bob Travica.
Chapter 5 Advanced Querying
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
Jerry Post Copyright © Database Management Systems Chapter 4 Queries.
School of Computer & Communication of LNPU 辽宁石油化工大学计算机与通信工程学院 刘旸 1 数据库管理系统 Database Management Systems Chapter4 Queries 第四章 数据查询.
1 Single Table Queries. 2 Objectives  SELECT, WHERE  AND / OR / NOT conditions  Computed columns  LIKE, IN, BETWEEN operators  ORDER BY, GROUP BY,
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
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.
Chapter 5 MYSQL Database. Introduction to MYSQL MySQL is the world's most popular open-source database. Open source means that the source code, the programming.
Jerry Post Copyright © Database Management Systems Chapter 5 Advanced Queries.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 7 Introduction to Structured.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
1 Copyright © 2010 Jerry Post & M. E. Kabay. All rights reserved. Queries: Part 2 of 2 IS240 – DBMS Lecture # 7 – M. E. Kabay, PhD, CISSP-ISSMP.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
ITEC 3220A Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220a.htm
1 All Powder Board and Ski Microsoft Access Workbook Chapter 5: Advanced Queries Jerry Post Copyright © 2003.
1 MySQL and SQL. 2 Topics  Introducing Relational Databases  Terminology  Managing Databases MySQL and SQL.
1 Copyright © 2010 Jerry Post & M. E. Kabay. All rights reserved. Queries: Part 1 of 2 IS240 – DBMS Lecture # 6 – M. E. Kabay, PhD, CISSP-ISSMP.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Jerry Post Copyright © Database Management Systems Chapter 4 Queries.
Jerry Post McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Database Management Systems Chapter 4 Data Queries.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
IMS 4212: Constraints & Triggers 1 Dr. Lawrence West, Management Dept., University of Central Florida Stored Procedures in SQL Server.
1 A Very Brief Introduction to Relational Databases.
CSCI N311: Oracle Database Programming 5-1 Chapter 15: Changing Data: insert, update, delete Insert Rollback Commit Update Delete Insert Statement –Allows.
Jerry Post Copyright © Database Management Systems Chapter 4 Queries.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
1 All Powder Board and Ski SQL Server Workbook Chapter 5: Advanced Queries Jerry Post Copyright © 2003.
 CONACT UC:  Magnific training   
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
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.
LEC-8 SQL. Indexes The CREATE INDEX statement is used to create indexes in tables. Indexes allow the database application to find data fast; without reading.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
1 Ch4 Summary Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
How to: SQL By: Sam Loch.
SQL Query Getting to the data ……..
Queries: Part 1 of 2 IS240 – DBMS Lecture # 6 –
M. E. Kabay, PhD, CISSP-ISSMP V:
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
SQL 101.
Data warehouse Design Using Oracle
Chapter 4 Summary Query.
Contents Preface I Introduction Lesson Objectives I-2
Presentation transcript:

1.NET Web Forms Database Queries © 2002 by Jerry Post

2 Why do we Need Queries  Natural languages (English) are too vague  With complex questions, it can be hard to verify that the question was interpreted correctly, and that the answer we received is truly correct.  Consider the question: Who are our best customers?  We need a query system with more structure  We need a standardized system so users and developers can learn one method that works on any (most) systems.  Query By Example (QBE)  SQL

3 Four Questions to Create a Query  What output do you want to see?  What do you already know (or what constraints are given)?  What tables are involved?  How are the tables joined together?

4 Tables

5 Organization  Single table  Constraints  Computations  Groups/Subtotals  Multiple Tables

6 Sample Questions  List all animals with yellow in their color.  List all dogs with yellow in their color born after 6/1/01.  List all merchandise for cats with a list price greater than $10.  List all dogs who are male and registered or who were born before 6/1/01 and have white in their color.  What is the average sale price of all animals?  What is the total cost we paid for all animals?  List the top 10 customers and total amount they spent.  How many cats are in the animal list?  Count the number of animals in each category.  List the CustomerID of everyone who bought something between 4/1/01 and 5/31/01.  List the first name and phone of every customer who bought something between 4/1/01 and 5/31/01.  List the last name and phone of anyone who bought a registered white cat between 6/1/01 and 12/31/01.  Which employee has sold the most items?

7 Query By Example & SQL  List all animals with yellow in their color. SELECTAnimalID, Category, Breed, Color FROMAnimal WHERE(Color LIKE “*yellow*”); What tables? What to see? What conditions? Query04_01

8 Basic SQL SELECT SELECTcolumnsWhat do you want to see? FROMtablesWhat tables are involved? JOINconditionsHow are the tables joined? WHEREcriteriaWhat are the constraints?

9 ORDER BY SELECTcolumns FROMtables JOINjoin columns WHEREconditions ORDER BYcolumns (ASC DESC) SELECT Name, Category, Breed FROM Animal ORDER BY Category, Breed; NameCategoryBreed CathyBirdAfrican Grey BirdCanary DebbieBirdCockatiel BirdCockatiel TerryBirdLovebird BirdOther CharlesBirdParakeet CurtisBirdParakeet RubyBirdParakeet SandyBirdParrot HoytBirdParrot BirdParrot

10 DISTINCT SELECT Category FROM Animal; Category Fish Dog Fish Cat Dog Fish Dog Fish Cat Dog... SELECT DISTINCT Category FROM Animal; Category Bird Cat Dog Fish Mammal Reptile Spider

11 Constraints: And  List all dogs with yellow in their color born after 6/1/01. SELECTAnimalID, Category, DateBorn FROMAnimal WHERE((Category="Dog") AND (Color Like "*Yellow*") AND (DateBorn>#6/1/2001#)); Query04_02

12 Conditions: AND, OR  List all dogs who are male and registered or who were born before 6/1/2001 and have white in their color. SELECT AnimalID, Category, Gender, Registered, DateBorn, Color FROM Animal WHERE (( Category="Dog") AND ( ( (Gender="Male") AND (Registered Is Not Null) ) OR ( (DateBorn<#6/1/2001#) AND (Color Like "*White*") ) ) ); Query04_03

13 Useful Where Conditions

14 Oracle Views

15 Oracle Views and SQL CREATE VIEW Pets.Example AS SELECTPets.Animal.AnimalID, Pets.Animal.Breed, Pets.Animal.Category, Pets.Animal.Color FROM Pets.Animal WHERE (Pets.Animal.Color LIKE ‘%Yellow%’) SQL version is created by the Oracle View Wizard. The CREATE VIEW command saves it with the specified name.

16 Oracle View Wizard

17 Oracle Schema Manager: Views

18 Oracle Content Viewer

19 SQL Server Views

20 Simple Computations OrderItem(OrderID, ItemID, Price, Quantity) Select OrderID, ItemID, Price, Quantity, Price*Quantity As Extended From OrderItem; Basic computations (+ - * /) can be performed on numeric data. The new display column should be given a meaningful name. OrderIDItemIDPriceQuantityExtended

21 Computations: Aggregation--Avg  What is the average sale price of all animals? SELECT Avg(SalePrice) AS AvgOfSalePrice FROM SaleAnimal;  Sum  Avg  Min  Max  Count  StDev  Var Query04_04

22 Computations (Math Operators)  What is the total value of the order for PONumber 22?  Use any common math operators on numeric data.  Operate on data in one row at a time.  OrderTotal  SELECT Sum([Quantity]*[Cost]) AS OrderTotal FROM OrderItem WHERE (PONumber=22); Query04_05

23 SQL Differences

24 Subtotals (Where)  How many cats are in the Animal list? SELECTCount(AnimalID) AS CountOfAnimalID FROMAnimal WHERE(Category = “Cat”); Query04_06

25 Groups and Subtotals  Count the number of animals in each category.  You could type in each WHERE clause, but that is slow.  And you would have to know all of the Category values. SELECTCategory, Count(AnimalID) AS CountOfAnimalID FROMAnimal GROUP BYCategory ORDER BYCount(AnimalID) DESC;  CategoryCountOfAnimalID  Dog100  Cat47  Bird15  Fish14  Reptile6  Mammal6  Spider3 Query04_07

26 Conditions on Totals (Having)  Count number of Animals in each Category, but only list them if more than 10.  CategoryCountOfAnimal  Dog100  Cat47  Bird15  Fish14 SELECTCategory, Count(AnimalID) AS CountOfAnimalID FROMAnimal GROUP BYCategory HAVINGCount(AnimalID) > 10 ORDER BYCount(AnimalID) DESC; Query04_08

27 Where (Detail) v Having (Group)  Count Animals born after 6/1/2001 in each Category, but only list Category if more than 10. CategoryCountOfAnimalID  Dog30  Cat18 SELECTCategory, Count(AnimalID) AS CountOfAnimalID FROMAnimal WHEREDateBorn > #6/1/2001# GROUP BYCategory HAVINGCount(AnimalID) > 10 ORDER BYCount(AnimalID) DESC; Query04_09

28 Multiple Tables (Intro & Distinct)  List the CustomerID of everyone who bought something between 4/1/01 and 5/31/01.  CustomerID  6  8  14  19  22  24  28  36  37  38  39  42  50  57  58  63  74  80  90 SELECT DISTINCT CustomerID FROM Sale WHERE (SaleDate Between #4/1/01# And #5/31/01#) ORDER BY CustomerID; Avoid Duplicates with DISTINCT Query04_10

29 Joining Tables  List LastNames of Customers who bought between 4/1/2001 and 5/31/2001.  CustomerIDLastName  22Adkins  57Carter  38Franklin  42Froedge  63Grimes  74Hinton  36Holland  6Hopkins  50Lee  58McCain  37McPherson  90Nichols  14Patterson  8Reid  28Samuels  80Vance  39Williams  24Young  19Zhang SELECT DISTINCT Sale.CustomerID, Customer.LastName FROM Customer INNER JOIN Sale ON Customer.CustomerID = Sale.CustomerID WHERE (Sale.SaleDate Between #4/1/2001# And #5/31/2001#) ORDER BY Customer.LastName; Query04_11

30 SQL JOIN FROM table1 INNER JOIN table2 ON table1.column = table2.column FROM table1, table2 JOIN table1.column = table2.column SQL 92 syntax (Access and SQL Server) Informal syntax FROM table1, table2 WHERE table1.column = table2.column SQL 89 syntax (Oracle)

31 Syntax for Three Tables FROM Table1 INNER JOIN (Table2 INNER JOIN Table3 ON Table2.ColA = Table3.ColA) ON Table1.ColB = Table2.ColB FROM Table1, Table2, Table3 JOINTable1.ColB = Table2.ColB Table2.ColA = Table3.ColA Easier notation, but not correct syntax SQL ‘92 syntax to join three tables

32 Multiple Tables (Many)  List the Last Name and Phone of anyone who bought a registered White cat between 6/1/2001 and 12/31/2001. SELECT DISTINCTROW Customer.LastName, Customer.Phone FROM Customer INNER JOIN (Sale INNER JOIN (Animal INNER JOIN SaleAnimal ON Animal.AnimalID = SaleAnimal.AnimalID) ON Sale.SaleID = SaleAnimal.SaleID) ON Customer.CustomerID = Sale.CustomerID WHERE ((Animal.Category="Cat") AND (Animal.Registered Is Not Null) AND (Color Like "*White*") AND (SaleDate Between #6/1/2001# And #12/31/2001#)); Query04_12

33 Building a Query  List the Last Name and Phone of anyone who bought a registered White cat between 6/1/01 and 12/31/ 01.  Identify the tables involved.  Look at the columns you want to see.  LastName, Phone: Customer  Look at the columns used in the constraints.  Registered, Color, Category: Animal  Sale Date: Sale  Find connector tables.  To connect Animal to Sale: SaleAnimal  Select the desired columns and test the query.  Enter the constraints.  Set Order By columns.  Add Group By columns.  Add summary computations to the SELECT statement.

34 Joining Tables (Hints)  Build Relationships First  Drag and drop  From one side to many side  Avoid multiple ties between tables  SQL  FROM Table1  INNER JOIN Table2  ON Table1.ColA = Table2.ColB  Join columns are often keys, but they can be any columns-- as long as the domains (types of data) match.  Multiple Tables  FROM (Table1  INNER JOIN Table2  ON T1.ColA = T2.ColB )  INNER JOIN Table3  ON T3.ColC = T3.ColD  Shorter Notation  FROM T1, T2, T3  JOIN T1.ColA = T2.ColB  T1.ColC = T3.ColD  Shorter Notation is not correct syntax, but it is easier to write.

35 Tables with Multiple Joins  Potential problem with three or more tables.  Access uses predefined relationships to automatically determine JOINs.  JOINS might loop.  Most queries will not work with loops. A query with these four tables with four JOINS would only return rows where the Employee had the same ZipCode as the Supplier. If you only need the Supplier city, just delete the JOIN between Employee and ZipCode. If you want both cities, add the ZipCode table again as a fifth table.

36 Table Alias SIDSupplier.CityIDCity.CityEIDLastNameEmployee.CityIDCity2.City 47972Middlesboro5James7083Orlando Springfield1Reeves9201Lincoln 47972Middlesboro3Reasoner8313Springfield Columbia8Carpenter10592Philadelphia Smyrna3Reasoner8313Springfield SELECT Supplier.SID, Supplier.CityID, City.City, Employee.EID, Employee.LastName, Employee.CityID, City2.City FROM (City INNER JOIN Supplier ON City.CityID = Supplier.CityID) INNER JOIN ((City AS City2 INNER JOIN Employee ON City2.CityID = Employee.CityID) INNER JOIN AnimalOrder ON Employee.EmployeeID = AnimalOrder.EmployeeID) ON Supplier.SupplierID = AnimalOrder.SupplierID;

37 Saved Query: Create View CREATE VIEW Kittens AS SELECT * FROM Animal WHERE (Category = ‘cat’) AND (Today - DateBorn < 180); SELECT Avg(ListPrice) FROM Kittens WHERE (Color LIKE “*Black*”);  Save a query  Faster: only enter once  Faster: only analyze once  Any SELECT statement  Can use the View within other SQL queries.

38 Updateable Views OrderItem(OrderID, ItemID, Quantity)Item(ItemID, Description) OrderLine(OrderID, ItemID, Description, Quantity)  To be updateable, a view must focus on one primary table. (OrderItem)  Goal is to change data in only one table. (OrderItem)  Data can be displayed from other tables. (Item)  Never include or attempt to change primary keys from more than one table. (Item.ItemID)

39 Non Updateable View OrderItem(OrderID, ItemID, Quantity)Item(ItemID, Description) OrderLine(OrderID, Item.ItemID, Description, Quantity) Cat food 58Dog food 59Bird food 12157Cat food Bird feeder Cat food1 If you attempt to change the Item.ItemID in the OrderLineView: You will simply change the primary key value in the Item table. It will not add a new row to the OrderItem table. 32

40 No Views are Updateable in.NET  Most databases do not really support updateable views very well, and Oracle had lots of problems. So, in.NET, you can only update underlying tables, not the views.  This approach complicates your applications.  But it is a realistic approach.

41 Primary Portability Hint  The DBMSs use different variations on SQL, particularly Oracle, which uses an older version.  To reduce application maintenance and make your application more portable:  Save all relatively complex queries in the database (as views).  Then use only simple Select queries in your application.  That includes all queries with:  JOIN  Concatenation  Most computations  In SQL Server, go a step further and save all of your queries as parameterized views.

42 SQL Data Definition  Create Schema Authorization dbName password  Create Table TableName (Column Type,...)  Alter Table Table {Add, Column, Constraint, Drop}  Drop {Table Table | Index Index On table}  Create Index IndexName ON Table (Column {ASC|DESC})

43 Syntax Examples CREATE TABLE Customer (CustomerID INTEGER NOT NULL, LastName CHAR (10), more columns ); ALTER TABLE Customer DROP COLUMN ZipCode; ALTER TABLE Customer ADD COLUMN CellPhone CHAR(15);

44 SQL Data Manipulation Commands Insert Into target (column1...) VALUES (value1...) Insert Into target (column1...) SELECT... FROM... Delete From table WHERE condition Update table SET Column=Value,... Where condition Note the use of the Select and Where conditions. Synatx is the same--only learn it once. You can also use subqueries.

45 Copy Old Animal Data INSERT INTO OldAnimals SELECT * FROM Animals WHERE AnimalID IN (SELECT AnimalOrderItem.AnimalID FROM AnimalOrder INNER JOIN AnimalOrderItem ON AnimalOrder.OrderID = AnimalOrderItem.OrderId WHERE (AnimalOrder.OrderDate<#1/1/01#) );

46 Delete Old Animal Data DELETE FROM Animals WHERE AnimalID IN (SELECT AnimalOrderItem.AnimalID FROM AnimalOrder INNER JOIN AnimalOrderItem ON AnimalOrder.OrderID = AnimalOrderItem.OrderId WHERE (AnimalOrder.OrderDate<#1/1/01#) );

47 Update Example  Change the ListPrice of Animals at the PetStore.  For cats, increase the ListPrice by 10%.  For dogs, increase the ListPrice by 20%.  Typically use two similar UPDATE statements.  With the CASE function, the statements can be combined. UPDATE Animal SET ListPrice = ListPrice*1.10 WHERE Category = “Cat” ; UPDATE Animal SET ListPrice = ListPrice*1.20 WHERE Category = “Dog” ;

48 Parameterized Queries  Parameterized queries often run faster and are somewhat easier to use in.NET.  Support for parameterized queries:  SQL ServerThe best of them all.  AccessOK, available in most cases.  OracleOK for action queries but hard with Select.  DB2Unknown.  SQL Server: CREATE PROCEDURE GetOrder int) AS SELECT OrderID, OrderDate, CustomerID FROM Order WHERE OrderID RETURN  Even if you cannot (or do not want to) create parameterized queries in the DBMS, we will create them within the code: cmdMine.CommandText = “SELECT OrderID, OrderDate, CustomerID FROM Order WHERE OrderID = ?

49 Importance of Parameterized Queries  Consider a typical SQL Update command: UPDATE Customer SET LastName = ‘O’Malley’ WHERE CustomerID=222  Note the problem with the name—it includes an apostrophe, which also happens to be the string delimiter for SQL. So, this statement will crash.  The statement will still fail even if you create a variable (sLastName = “O’Malley”)  strSQL = “UPDATE Customer SET LastName = “ & sLastName …  But, if you create a parameterized query, it will work! strSQL = “UPDATE Customer SET LastName=? WHERE CustomerID=?” Parameter 0 is “O’Malley” Parameter 1 is 222  You must always use parameterized queries for UPDATE and INSERT, so you might as well use them all of the time.

50 SQL Syntax List  ALTER TABLE ALTER TABLE  COMMIT COMMIT  CREATE INDEX CREATE INDEX  CREATE TABLE CREATE TABLE  CREATE VIEW CREATE VIEW  DELETE DELETE  DROP DROP  INSERT INSERT  GRANT GRANT  REVOKE REVOKE  ROLLBACK ROLLBACK  SELECT SELECT  SELECT INTO SELECT INTO  UPDATE UPDATE

51 SQL Syntax: ALTER TABLE ALTER TABLE table ADD COLUMN column datatype (size) DROP COLUMN column See also: CREATE TABLE DROP TABLE Return to List

52 SQL Syntax: COMMIT COMMIT WORK See also: ROLLBACK Return to List

53 SQL Syntax: CREATE INDEX CREATE [UNIQUE] INDEX index ON table (column1, column2, … ) WITH {PRIMARY | DISALLOW NULL | IGNORE NULL} See also: CREATE TABLE Return to List

54 SQL Syntax: CREATE TABLE CREATE TABLE table ( column1datatype (size) [NOT NULL] [index1], column2datatype (size) [NOT NULL] [index2], …, CONSTRAINT pkname PRIMARY KEY (column, …), CONSTRAINT fkname FOREIGN KEY (column) REFERENCES existing_table (key_column), ) See also: ALTER TABLE DROP TABLE Return to List

55 SQL Syntax: CREATE VIEW CREATE VIEW viewname AS SELECT … See also: SELECT Return to List

56 SQL Syntax: DELETE DELETE FROM table WHERE condition See also: DROP Return to List

57 SQL Syntax: DROP DROP INDEX index ON table DROP TABLE DROP VIEW See also: DELETE Return to List

58 SQL Syntax: GRANT GRANT privilege privileges ON object ALL, ALTER, DELETE, INDEX, TO user | PUBLIC INSERT, SELECT, UPDATE See also: REVOKE Return to List

59 SQL Syntax: INSERT INSERT INTO table (column1, column2, …) VALUES (value1, value2, … ) INSERT INTO newtable (column1, column2, …) SELECT … See also: SELECT Return to List

60 SQL Syntax: REVOKE REVOKE privilege privileges ON object ALL, ALTER, DELETE, INDEX, FROM user | PUBLIC INSERT, SELECT, UPDATE See also: GRANT Return to List

61 SQL Syntax: ROLLBACK SAVEPOINT savepoint{optional} ROLLBACK WORK TO savepoint See also: COMMIT Return to List

62 SQL Syntax: SELECT SELECT DISTINCT table.column {AS alias},... FROM table/query INNER JOIN table/query ON T1.ColA = T2.ColB WHERE (condition) GROUP BY column HAVING (group condition) ORDER BY table.column { UNION, INTERSECT, EXCEPT … } GROUP BY CUBE (dimension1, dimension2, …) TRANSFORM aggfunction{Crosstab values} SELECT... FROM... GROUP BY{Crosstab rows} PIVOT pivot column {Crosstab columns} Return to List

63 SQL Syntax: SELECT INTO SELECT column1, column2, … INTO newtable FROM tables WHERE condition See also: SELECT Return to List

64 SQL Syntax: UPDATE UPDATE TABLE table SET column1 = value1, column2 = value2, … WHERE condition See also: DELETE Return to List