You are on page 1of 2

Overview:

Codd's rule - set of 13 rules that define relational databases based on set theory,
increased the rules to hundreds

SQL Commands - 3 types


DDL - Data Definition Language - commands that actually defines a database objects
like create the tables, create the fields. add primary keys,
CREATE - to create new objects such as New table, new views
ALTER - to alter existing objects like altering existing tables, adding or
removing columns
DROP - Allows to drop objects from DB like remove a table, remove a view
TRUNCATE - effectively takes away all the data within the table but leaves the
structure in place and any automatic numbering with in it will be restarted
Its not same as drop command as DROP physically delete the whole table

DML - Data Manipulation language - commands to manipulate the data within data
objects like selecting data, inserting data, updating data, Deleting data
SELECT - Extract data from database
SELECT FIELD(S)
FROM TABLES

JOIN OTHER TABLES


WHERE CRITERIA
GROUP BY ANY GROUPS
HAVING FILTER FOR GROUPED VALUES
ORDER BY SORT ORDER

INSERT
UPDATE
DELETE

DCL - Data Control Language - control the permission that give access the data
objects that you created through DDL Commands
GRANT - Permitting access to a particular object
REVOKE - Revoking access to a particular object
-- File size and growth
---can specify the size of DB file (.mdf) in KB, MB, GB, TB where MB is default
---default size is the size of the primary file in model DB

---DB usually grows in size as data is added


---The file size can be managed using few options
--MAXSIZE specifies the maximum size to which the file can grow
--UNLIMITED - allows the file to grow until the disk is full
- Log files are actually limited to 2 TB while data files are limited
to 16 TB
--FILEGROWTH can be used to allow files to grow automatically as needed in
KB, MB, GB, TB or as a percentage
- Autogrowth cannot exceed the MAXSIZE setting

-- File Location
- every Db has atleast 2 files - Primary file for data (.MDF) and transaction log
file (.LDF)
- Additional data files can be created with .NDF file extension
-Transaction log file should be located on a separate physical disk if possible

--File Groups
--
Create Database Databasename
Three basic options to understand when creating databases

You might also like