Data Definition
DDL allows database objects such as schemas,domain,tables,views and indexes to be created and destroyed.
The main sql DDL statements are:
CREATE SCHEMA DROP
SCHEMA
CREATE DOMAIN ALTER DOMAIN DROPDOMAIN
CREATE TABLE ALTER TABLE DROP TABLE
CREATE VIEW DROP VIEWCreating a Database
This diffres from product.According to the ISO stand relations and other database objets exists in an enviroment .Among other things,Objects exits in an enviroment.Among other things,each enviroment consists of one or more catalogs , and catalog consists of a set of schemas.A schemas is a named collection of database objects there are in some way related to one another.The objects in a character sets.A schema can be created and destroyed in the following manner.
Create SCHEME[Name | Authorization creatorindentifier]
Drop SCHEME Name[RESTRICT | CASCADE]
Pattern match
Test whether a strings maches a specified condition.SQL has 2 speacial pattern-matching symbols;
- % - represents any sequence of zero/more characters
- _ - underscore represents any single characters
- LIKE 'k%' means that 1 character must be,but the rest of it can be anythings
- LIKE 'M_ _ _' means that thare must be extacly 4 characters in the sting,and should start with m
- LIKE '%w' means any sequence of characterss of length at least 1,with the last character being w
- LIKE '%GLASSGOW%' means a sequens of characters of any length containing Glassgow
- NOT LIKE 'H%' means the 1st character cannot be an H
Example
SELECT WHERE ClintNo= '' or by any other logical operator such as '<>'
NULL
test whether a column has a null(unknwon) value.In some cases, a value in a table will not cantain any value.Then,you will not be able to refer to that particular row in the following manner.
SELECT...
WHERE clientNO = ''
or
by any other logical operator such as '<>'This is becouse,a null value is considered to have an unknown value,so we cannot test whether it is equal or not equal to another string.instead,we have to test for null explicitly,using the keywords NULL/IS NOTNULL
SELECT...
WHERE clientNO IS NULL 