Submit Search
Upload
SQL Introduction
•
0 likes
•
319 views
AI-enhanced title
Hikmat Dhamee
Follow
This is one of the slide I got in college folder and would like to share.
Read less
Read more
Education
Report
Share
Report
Share
1 of 8
Download now
Download to read offline
Recommended
Les14
Les14
arnold 7490
Sql ch 15 - sql security
Sql ch 15 - sql security
Mukesh Tekwani
SQLの話
SQLの話
Akihiro Okuno
Les14[1]Controlling User Access
Les14[1]Controlling User Access
siavosh kaviani
Kp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan user
Desty Yani
User, roles and privileges
User, roles and privileges
Yogiji Creations
Controlling User Access -Data base
Controlling User Access -Data base
Salman Memon
Difference Between Sql - MySql and Oracle
Difference Between Sql - MySql and Oracle
Steve Johnson
Recommended
Les14
Les14
arnold 7490
Sql ch 15 - sql security
Sql ch 15 - sql security
Mukesh Tekwani
SQLの話
SQLの話
Akihiro Okuno
Les14[1]Controlling User Access
Les14[1]Controlling User Access
siavosh kaviani
Kp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan user
Desty Yani
User, roles and privileges
User, roles and privileges
Yogiji Creations
Controlling User Access -Data base
Controlling User Access -Data base
Salman Memon
Difference Between Sql - MySql and Oracle
Difference Between Sql - MySql and Oracle
Steve Johnson
A Tour to MySQL Commands
A Tour to MySQL Commands
Hikmat Dhamee
Introduction to Apache Hadoop
Introduction to Apache Hadoop
Hikmat Dhamee
Course Catalog
Course Catalog
Dan D'Urso
SQL200.1 Module 1
SQL200.1 Module 1
Dan D'Urso
php&mysql with Ethical Hacking
php&mysql with Ethical Hacking
BCET
Chapter08
Chapter08
sasa_eldoby
Chapter10
Chapter10
sasa_eldoby
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
Prosanta Ghosh
CIS110 Computer Programming Design Chapter (9)
CIS110 Computer Programming Design Chapter (9)
Dr. Ahmed Al Zaidy
5 the relational algebra and calculus
5 the relational algebra and calculus
Kumar
7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies
Kumar
Relational algebra in dbms
Relational algebra in dbms
shekhar1991
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Frans Jongma
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Frans Jongma
Mysql Datadictionary
Mysql Datadictionary
rootuser
Copy Of Mysql Datadictionary
Copy Of Mysql Datadictionary
Golak Sarangi
Sql tutorial
Sql tutorial
Rumman Ansari
Android sq lite-chapter 22
Android sq lite-chapter 22
Dr. Ramkumar Lakshminarayanan
Database administration
Database administration
abhi_love
Sql database development part 1
Sql database development part 1
Sqlperfomance
Sql views, stored procedure, functions
Sql views, stored procedure, functions
Om Vikram Thapa
MySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
More Related Content
Viewers also liked
A Tour to MySQL Commands
A Tour to MySQL Commands
Hikmat Dhamee
Introduction to Apache Hadoop
Introduction to Apache Hadoop
Hikmat Dhamee
Course Catalog
Course Catalog
Dan D'Urso
SQL200.1 Module 1
SQL200.1 Module 1
Dan D'Urso
php&mysql with Ethical Hacking
php&mysql with Ethical Hacking
BCET
Chapter08
Chapter08
sasa_eldoby
Chapter10
Chapter10
sasa_eldoby
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
Prosanta Ghosh
CIS110 Computer Programming Design Chapter (9)
CIS110 Computer Programming Design Chapter (9)
Dr. Ahmed Al Zaidy
5 the relational algebra and calculus
5 the relational algebra and calculus
Kumar
7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies
Kumar
Relational algebra in dbms
Relational algebra in dbms
shekhar1991
Viewers also liked
(12)
A Tour to MySQL Commands
A Tour to MySQL Commands
Introduction to Apache Hadoop
Introduction to Apache Hadoop
Course Catalog
Course Catalog
SQL200.1 Module 1
SQL200.1 Module 1
php&mysql with Ethical Hacking
php&mysql with Ethical Hacking
Chapter08
Chapter08
Chapter10
Chapter10
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
CIS110 Computer Programming Design Chapter (9)
CIS110 Computer Programming Design Chapter (9)
5 the relational algebra and calculus
5 the relational algebra and calculus
7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies
Relational algebra in dbms
Relational algebra in dbms
Similar to SQL Introduction
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Frans Jongma
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Frans Jongma
Mysql Datadictionary
Mysql Datadictionary
rootuser
Copy Of Mysql Datadictionary
Copy Of Mysql Datadictionary
Golak Sarangi
Sql tutorial
Sql tutorial
Rumman Ansari
Android sq lite-chapter 22
Android sq lite-chapter 22
Dr. Ramkumar Lakshminarayanan
Database administration
Database administration
abhi_love
Sql database development part 1
Sql database development part 1
Sqlperfomance
Sql views, stored procedure, functions
Sql views, stored procedure, functions
Om Vikram Thapa
MySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
Dan D'Urso
MySQL Reference Manual
MySQL Reference Manual
webhostingguy
SQL.pptx
SQL.pptx
ajeetyadav541305
mySQL and Relational Databases
mySQL and Relational Databases
webhostingguy
Oracle training in hyderabad
Oracle training in hyderabad
Kelly Technologies
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
AbhishekKumarPandit5
Sqlite3 command reference
Sqlite3 command reference
Raghu nath
SQL Commands
SQL Commands
Divyank Jindal
Sql Summit Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
David Truxall
Similar to SQL Introduction
(20)
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objects
Mysql Datadictionary
Mysql Datadictionary
Copy Of Mysql Datadictionary
Copy Of Mysql Datadictionary
Sql tutorial
Sql tutorial
Android sq lite-chapter 22
Android sq lite-chapter 22
Database administration
Database administration
Sql database development part 1
Sql database development part 1
Sql views, stored procedure, functions
Sql views, stored procedure, functions
MySQL and its basic commands
MySQL and its basic commands
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
MySQL Reference Manual
MySQL Reference Manual
SQL.pptx
SQL.pptx
mySQL and Relational Databases
mySQL and Relational Databases
Oracle training in hyderabad
Oracle training in hyderabad
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
Sqlite3 command reference
Sqlite3 command reference
SQL Commands
SQL Commands
Sql Summit Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
Recently uploaded
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
Sapna Thakur
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
National Information Standards Organization (NISO)
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Steve Thomason
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
EduSkills OECD
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
pragatimahajan3
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
misteraugie
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
nomboosow
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
TechSoup
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
dawncurless
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Thiyagu K
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
agholdier
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
Admir Softic
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
Celine George
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
RAM LAL ANAND COLLEGE, DELHI UNIVERSITY.
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Jayanti Pande
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
sanyamsingh5019
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
Disha Kariya
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
VishalSingh1417
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
Recently uploaded
(20)
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SQL Introduction
1.
SQL Originally, SQL was called SEQUEL (Structured English QUEry Language) and was designed and implemented at IBM Research as the interface for an experimental relational database system called SYSTEM R. A joint effort by ANSI and ISO has led to a standard version of SQL (ANSI 1986), called SQL86 or SQLl. A revised and much expanded standard called SQL2 (also referred to as SQL92) was subsequently developed. The next version of the standard was originally called SQL3, but is now called SQL99. We will try to cover the latest version of SQL as much as possible. SQL Schema: An SQL schema is identified by a schema name, and includes an authorization identifier to indicate the user or account who owns the schema, as well as descriptors for each element in the schema. Schema elements include tables, constraints, views, domains, and other constructs (such as authorization grants) that describe the schema. A schema is created via the CREATE SCHEMA statement, which can include all the schema elements' definitions. Alternatively, the schema can be assigned a name and authorization identifier, and the elements can be defined later. For example, the following statement creates a schema called COMPANY, owned by the user with authorization identifier JSMITH: CREATE SCHEMA COMPANY AUTHORIZATION JSMITH; SQL Catalog A named collection of schemas in an SQL environment. An SQL environment is basically an installation of an SQLcompliant RDBMS on a computer sysrem. A catalog always contains a special schema called INFORMATION_SCHEMA, which provides information on all the schemas in the catalog and all the element descriptors in these schemas. Integrity constraints such as referential integrity can be defined between relations only if they exist in schemas within the same catalog. Schemas within the same catalog can also share certain elements, such as domain definitions. Persistent data Persistent data is data whose lifetime typically exceeds that of individual application program executions. In other words, it is data that (a) is stored in the database and (b) persists from the moment it is created until the moment it is explicitly destroyed. A relationship is an association among entities. Security means the protection of the data in the database against unauthorized access. a. Security means making sure users are allowed to do the things they're trying to do. b. Integrity means making sure the things they're trying to do are correct. A host language is a language in which a data sublanguage is embedded. The host language is responsible for providing various nondatabase facilities, such as I/O operations, local
2.
variables, computational operations, ifthenelse logic, and so on. A foreign key is a column or combination of columns in one relation whose values are required to match those of the primary key in some other relation (or possibly in the same relation). Privileges are the actions that a user is permitted to carry out for a given database object Four types of database constraints (uniqueness constraints, primary and foreign key constraints, and check constraints) are closely associated with a single database table. They are specified as part of the CREATE TABLE statement and can be modified or dropped using the ALTER TABLE statement. The other two types of database integrity constraints, assertions and domains, are created as independent "objects" within a database, independent of any individual table definition. INTEGRITY CONSTRAINTS An integrity constraint is a condition specified on a database schema which prevents the entry of incorrect information and restricts the data that can be stored in an instance of the database to satisfy this constraint. Domain Constraints and Distinct Types CREATE TYPE ratingtype AS INTEGER This statement defines a new distinct type called ratingtype, with INTEGER as its source type A user can define a new domain using the CREATE DOMAIN statement, which uses CHECK constraints CREATE DOMAIN ratingval INTEGER DEFAULT 1 CHECK ( VALUE >= 1 AND VALUE <= 10 ) Key Constraints 1. Primary key constraint CREATE TABLE Students ( sid CHAR(20) , name CHAR (30) , login CHAR(20) , age INTEGER, gpa REAL, UNIQUE (name, age), CONSTRAINT StudentsKey PRIMARY KEY (sid) ); While violating the constraint, constraint name eg. StudentsKey is returned as error. 2. Foreign key constraint CREATE TABLE Enrolled ( studid CHAR(20) , cid CHAR(20), grade CHAR(10), PRIMARY KEY (studid, cid), FOREIGN KEY (studid) REFERENCES Students );
3.
General Constraints Constraints over a Single Table SQL supports the creation of assertions, which are constraints not associated with anyone table. As an example, suppose that we wish to enforce the constraint that the number of boats plus the number of sailors should be less than 100. CREATE ASSERTION smallClub CHECK (( SELECT COUNT (S.sid) FROM Sailors S ) ( SELECT COUNT (B. bid) FROM Boats B) < 100 ) We can specify complex constraints over a single table using table constraints, which have the form CHECK conditionalexpression. For example, to ensure that rating must be an integer in the range 1 to 10, we could use: CREATE TABLE Sailors ( sid INTEGER, sname CHAR(10), rating INTEGER, age REAL, PRIMARY KEY (sid), CHECK (rating >= 1 AND rating <= 10 )) NULL It I s used to represent a missing value, but that it usually has one of three different interpretationsvalue unknown (exists but is not known), value not available (exists but is purposely withheld), or attribute not applicable (undefined for this tuple). Consider the following examples to illustrate each of the three meanings of NULL. 1. Unknown value: A particular person has a date of birth but it is not known, so it is represented by NULL in the database. 2. Unavailable or withheld value: A person has a home phone but does not want it to be listed, so it is withheld and represented as NULL in the database. 3. Not applicable attribute: An attribute LastCollegeDegree would be NULL for a person who has no college degrees, because it does not apply to that person. SQL Command Types: SQL is a tool for organizing, managing, and retrieving data stored by a computer Database. In fact, SQL works with one specific type of database, called a relational database. SQL is used to control all of the functions that a DBMS provides for its users, including: • Data definition • Data retrieval. • Data manipulation. • Access control. • Data sharing. • Data integrity. SQL is not really a complete computer language like COBOL, C, C++, or Java. SQL contains no IF statement for testing conditions, and no GOTO, DO, or FOR statements for program flow control. Instead, SQL is a database sublanguage, consisting of about forty statements specialized for database management tasks The main body of the SQL language consists of about 40 statements, which are Summarized below: Each statement requests a specific action from the DBMS, such as creating a new table, retrieving data, or inserting new data into the database Data Manipulation(DML4) SELECT Retrieves data from the database INSERT A dds new rows of data to the database DELETE Removes rows of data from the database
4.
UPDATE Modifies existing database data Data Definition(DDL12) CREATE TABLE Adds a new table to the database DROP TABLE Removes a table from the database ALTER TABLE Changes the structure of an existing table CREATE VIEW A dds a new view to the database DROP VIEW Removes a view from the database CREATE INDEX B uilds an index for a column DROP INDEX Removes the index for a column CREATE SCHEMA A dds a new schema to the database DROP SCHEMA Removes a schema from the database CREATE DOMAIN A dds a new data value domain ALTER DOMAIN Changes a domain definition DROP DOMAIN Removes a domain from the database Access Control (ACL or DCL 2+) GRANT Grants user access privileges REVOKE Removes user access privileges Transaction Control (TCL 4+) COMMIT Ends the current transaction ROLLBACK Aborts the current transaction SET TRANSACTION Defines data access characteristics of the current transaction Programmatic SQL DECLARE Defines a cursor for a query EXPLAIN Describes the data access plan for a query OPEN Opens a cursor to retrieve query results FETCH Retrieves a row of query results CLOSE Closes a cursor PREPARE
5.
Prepares a SQL statement for dynamic execution EXECUTE Executes a SQL statement dynamically DESCRIBE Describes a prepared query . SQL KEY WORDS (207+) and POTENTIAL ANSI/ISO KEY WORDS(75+) Most DBMS brands allow different users to create tables with the same name With the proper permission, you can also refer to tables owned by other users, by using a qualified table name. A qualified table name specifies both the name of the table's owner(ie.schema name) and the name of the table, separated by a period (.). A qualified column name specifies both the name of the table containing the column and the name of the column, separated by a period (.). SQL Data Types The ANSI/ISO SQL standard specifies the various types of data that can be stored in a SQLbased database and manipulated by the SQL language. The original SQL1 standard specified only a minimal set of data types. The SQL2 standard expanded this list to include variablelength character strings, date and time data, bit strings, and other types. Today's commercial DBMS products can process a rich variety of different kinds of data, and there is considerable diversity in the particular data types supported across different DBMS brands. Typical data types include: •Integers. Columns holding this type of data typically store counts, quantities, ages, and so on. Integer columns are also frequently used to contain I.D. numbers, such as customer, employee, and order numbers. •Decimal numbers. Columns with this data type store numbers that have fractional parts and must be calculated exactly, such as rates and percentages. They are also frequently used to store money amounts. •Floating point numbers. Columns with this data type are used to store scientific numbers that can be calculated approximately, such as weights and distances. Floating point numbers can represent a larger range of values than decimal numbers but can produce roundoff errors in computations. • Fixedlength character strings. Columns holding this type of data typically store names of people and companies, addresses, descriptions, and so on. •Variablelength character strings. This data type allows a column to store character strings that vary in length from row to row, up to some maximum length. (The SQL1 standard permitted only fixedlength character strings, which are easier for the DBMS to process but can waste considerable space.) •Money amounts. Many SQL products support a MONEY or CURRENCY type, which is usually stored as a decimal or floating point number. Having a distinct money type allows the DBMS to properly format money amounts when they are displayed. •Dates and times. Support for date/time values is also common in SQL products, although the details vary dramatically from one product to another. Various combinations of dates, times, timestamps, time intervals, and date/time arithmetic are generally supported. The SQL2 standard includes an elaborate specification for DATE, TIME, TIMESTAMP, and INTERVAL data types, including support for time zones and time precision (for example, tenths or hundredths of seconds).
6.
•Boolean data. Some SQL products, such as Informix Dynamic Server, support logical (TRUE or FALSE) values as an explicit type, and some permit logical operations (comparison, AND/OR, and so on) on the stored data within SQL statements. •Long text. Several SQLbased databases support columns that store long text strings (typically up to 32,000 or 65,000 characters, and in some cases even larger). This allows the database to store entire documents, product descriptions, technical papers, resumes, and similar unstructured text data. The DBMS usually restricts the use of these columns in interactive queries and searches. •Unstructured byte streams. Several DBMS products allow unstructured, variablelength sequences of bytes to be stored and retrieved. Columns containing this data are used to store compressed video images, executable code, and other types of unstructured data. SQL Server's IMAGE data type, for example, can store a stream of up to 2 billion bytes of data. •Asian characters. As databases grow to support global applications, DBMS vendors have added support for fixedlength and variablelength strings of 16bit characters used to represent Kanji and other Asian characters. Searching and sorting on these GRAPHIC and VARGRAPHIC types is usually not permitted, however The following list lists the data types specified in the ANSI/ISO SQL standard. Data Type Description CHAR(len) CHARACTER(len) Fixedlength character strings VARCHAR(len) CHAR VARYING(len) CHARACTER VARYING(len) Variablelength character strings* NCHAR(len) NATIONAL CHAR(len) NATIONAL CHARACTER(len) Fixedlength national character strings* NCHAR VARYING(len) NATIONAL CHAR VARYING(len) NATIONAL CHARACTER VARYING(len) Variablelength national character strings* INTEGER INT Integer numbers SMALLINT Small integer numbers BIT(len) Fixedlength bit string* BIT VARYING(len) Variablelength bit string* NUMERIC(precision,scale) DECIMAL(precision,scale) DEC(precision,scale) Decimal numbers FLOAT(precision) Floating point numbers REAL Lowprecision floating point numbers DOUBLE PRECISION Highprecision floating point numbers DATE
7.
Calendar date* TIME(precision) Clock time* TIMESTAMP(precision) Date and time* INTERVAL Time interval* Builtin SQL2 Functions Function Returns BIT_LENGTH(string) Number of bits in a bit string CAST(value AS data_type) The value, converted to the specified data type (e.g.,a date converted to a character string) CHAR_LENGTH(string) Length of a character string CONVERT(string USING conv) String converted as specified by a named conversion function CURRENT_DATE Current date CURRENT_TIME(precision) Current time, with the specified precision CURRENT_TIMESTAMP(precision) Current date and time, with the specified precision EXTRACT(part FROM source) Specified part (DAY, HOUR, etc.) from a DATETIME value LOWER(string) String converted to all lowercase letters OCTET_LENGTH(string) Number of 8bit bytes in a character string POSITION(target IN source) Position where the target string appears within the source string SUBSTRING(source FROM nFOR len) A portion of the source string, beginning at the nth c haracter, for a length of len TRANSLATE(string USING trans) String translated as specified by a named translation function TRIM(BOTH char FROM string) String with both leading and trailing occurrences of char trimmed off TRIM(LEADING char FROM string) String with any leading occurrences of char trimmed off TRIM(TRAILING char FROM string) String with any trailing occurrences of char trimmed off UPPER(string)
8.
String converted to all uppercase letters SQL Operators Comparison Test (=, <>, <, <=, >, >=) Range Test (BETWEEN) Set Membership Test (IN) Pattern Matching Test (LIKE) Wildcard Characters (%,_) Escape Characters * Null Value Test (IS NULL) Compound Search Conditions (AND, OR, and NOT) Sorting Query Results (ORDER BY Clause) Combining Query Results (UNION ALL and UNION DISTINCT) * SQL2 UNION, INTERSECT, and DIFFERENCE(EXCEPT) Operator Embedded SQL Commercial SQL database vendors offer two basic techniques for using SQL within an application program: •Embedded SQL. In this approach, SQL statements are embedded directly into the program's source code, intermixed with the other programming language statements. Special embedded SQL statements are used to retrieve data into the program. A special SQL precompiler accepts the combined source code and, along with other programming tools, converts it into an executable program. •Application program interface. In this approach, the program communicates with the DBMS through a set of function calls called an application program interface, or API. The program passes SQL statements to the DBMS through the API calls and uses API calls to retrieve query results. This approach does not require a special precompiler. Dynamic SQL Concepts The central concept of dynamic SQL is simple: don't hardcode an embedded SQL statement into the program's source code. Instead, let the program build the text of a SQL statement in one of its data areas at runtime. The program then passes the statement text to the DBMS for execution "on the fly." Although the details get quite complex, all of dynamic SQL is built on this simple concept, and it's a good idea to keep it in mind.
Download now