What is the purpose of a Data-Manipulation Language and Data-Definition Language?

Data Definition Language (DDL)-subset of SQl that has commands to manage and administer DB. Data definition language (DDL) statements define, structurally change, and drop schema objects.A logical structure of data stored in a schema. Examples of schema objects are tables, indexes, sequences, and database links. Commands of DDL:

CREATE TABLE,DROP TABLE,ALTER TABLE,CREATE VIEW, ALTER VIEW,DROP VIEW,CREATE INDEX,DROP INDEX and etc.

CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object.

Data manipulation language (DML) statements query or manipulate data in existing schema objects. Whereas DDL statements enable you to change the structure of the database, DML statements enable you to query or change the contents. For example, ALTER TABLE changes the structure of a table, whereas INSERT adds one or more rows to the table.In short Dml –works with table’s rows. The main Commands: delete,insert.update.

INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes all records from a table, the space for the records remain

MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
LOCK TABLE - control concurrency

What is the maximum length of a table name, database name, and fieldname in MySQL?

 

MySQL is an open source database management system. It is highly popular because of its high reliability, ease of use and high performance. MySQL is used for many latest applications.

The following table describes the maximum length and allowable characters for each type of identifier.

 

Identifier MaximumLength (bytes) AllowedCharacters
Database   Any character that is allowed in a directory name, except ‘/’, ‘\’, or ‘.’
Table   Any character that is allowed in a filename, except ‘/’, ‘\’, or ‘.’
Column   Allcharacters
Index   Allcharacters
Alias   Allcharacters

 

For MySql:

tablename=64characters long (maximum)

databasename=64characters long (maximum)

fieldname=64characters long (maximum)

 

In addition to the restrictions noted in the table, no identifier can contain ASCII 0 or a byte with a value of 255. Database, table, and column names should not end with space characters. The use of identifier quote characters in identifiers is permitted, although it is best to avoid doing so if possible.

Identifiers are stored using Unicode. This applies to identifiers in table definitions that stored in.frm files and to identifiers stored in the grant tables in the mysql database. The sizes of the string columns in the grant tables (and in any other tables) in MySQL 5.1 are given as number of characters. This means that (unlike some earlier versions of MySQL) we can use multi-byte characters without reducing the number of characters allowed for values stored in these columns.


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: