## SQL

### Use

You can use the Structured Query Language (SQL) to define, display, insert, change and delete data in the database. The database system executes SQL statements within transactions.

The SQL statements are divided into the following groups:

● Data definition

● Authorization

● Data manipulation

● Data query

● Transactions

● Statistics

For an introduction to the MaxDB SQL syntax, see the SQL Tutorial; for a complete description, see the SQL Reference Manual.

### Activities

● To program a database application, you can embed SQL statements in the programming language of your choice and send them to the database instance via an interface.

Users of the database application then enter SQL statements only implicitly.

● You can explicitly enter SQL statements with the following database tools, among others:

○ SQL Studio (GUI, o nly for Microsoft Windows)

○ SQLCLI (command line for all su pported operating systems)

○ Web SQL (web-based, for all su pported operating systems)

### Features

In the MaxDB database system you can use the following data types, among others: BOOLEAN, CHAR[ACTER] (ASCII, BYTE, UNICODE), DATE, FIXED, FLOAT, INT[EGER], LONG (ASCII, BYTE,UNICODE) for saving BLOBs and CLOBs, SMALLINT, TIME, TIMESTAMP, VARCHAR (ASCII, BYTE, UNICODE). See the SQL Reference Manual, Data Type (data_type).

By working with the database system, you can choose the SQL mode. For more information about the differences between the SQL modes INTERNAL and ORACLE, see the SQL Mode ORACLE documentation.

Important SQL Properties of MaxDB

Property | More Information
Schema | SQL Reference Manual, CREATE SCHEMA Statement (create_schema_statement)
Foreign keys (referential integrity) | SQL Tutorial, Foreign Key Dependencies Between Tables SQL Reference Manual, Referential CONSTRAINT Definition (referential_constraint_definition)
Explicit and implicit locks on rows, tables and the database catalog | SQL Reference Manual, Transactions LOCK Statement (lock_statement) LOCK Option (lock_option)
Updatable view table | SQL Tutorial, View Tables SQL Reference Manual, CREATE VIEW Statement (create_view_statement)
Temporary table | SQL Reference Manual, CREATE TABLE Statement (create_table_statement)
Domain definition | SQL Tutorial, Domains SQL Reference Manual, CREATE DOMAIN Statement (create_domain_statement)
Outer join | SQL Tutorial, Joins: Information from Several Tables SQL Reference Manual, JOIN Predicate (join_predicate)
Subquery | SQL Tutorial, Subquery: Inner Queries SQL Reference Manual, Subquery (subquery)
Subtransaction | SQL Reference Manual, SUBTRANS Statement (subtrans_statement)
Number generator (auto-increment column) | SQL Tutorial, Number Generators for Tables SQL Reference Manual, CREATE SEQUENCE Statement (create_sequence_statement)
Database procedure (stored procedures) | SQL Tutorial, Database Procedures SQL Reference Manual, CREATE DBPROC[EDURE] Statement (create_dbproc_statement)
Database function (user-defined function) | SQL Tutorial, Database Functions SQL Reference Manual, CREATE FUNCTION Statement (create_function_statement)
Triggers | SQL Tutorial Database Triggers SQL Reference Manual, CREATE TRIGGER Statement (create_trigger_statement) CREATE SYSTEM TRIGGER Statement (create_system_trigger_statement)
Server-side cursor | SQL Reference Manual, DECLARE CURSOR Statement (declare_cursor_statement)
Shared SQL (re-use of execution plans) | Special Database Parameters SHAREDSQL
Optimization | SQL Optimizer

You can find an overview of all SQL statements in the SQL Reference Manual under SQL Statements: Overview.

For information about restrictions, see the SQL Reference Manual, Restrictions for SQL Statements

See also:

Transactions

Locks for Database Objects

Developing Database Applications

Overview of the Database System