MySQL is the world most popular open source database. It is also the fastestgrowing database in the industry, with over 70,000 downloads per day. MySQL isa command line program that act as a text based front end for the server. It isused for issuing queries and viewing the results interactively.SQL means (Structured Query Language), the way of describing a database in atabular form.SQL divided into many parts of command:1. DDL (Data Definition Language command). It is only a structure ofdatabase. It contains Creation, Altering and Drop.2.DML (Data manipulation Language command). Is a language that providesa set of operations to support the basic data manipulation operations on thedata held in the database.Operation such as:Insertion of new data into database.Modification of data stored in the database.Retrieval of data contained in the database.Deletion of data from the database.3.DCL (Data Control Language command). That is (Grant, Revoke) means itsallow you have an access to the data or to hide the data by using somePage | 21 Mr. Saifullahi Muhammad
Lecture NoteIntroduction to File Processingcommand, you can may be have an access to data to view but you cannothave permission to change the data for security reasons.4.TCL (Transaction Control Language command). Is a logical unit of work onthe database, an action or series of actions carried out by a single user orapplication program, which reads or updates the contents of the database. DATA TYPESIn MySQL the data types available can be broken down into four (4) majorcategories:-NumericInteger for storing whole numbers e.g. Population INT (11)Floating – point that store approximate value (real) numbers e.g.FLOAT (8,2) or DOUBLE (10,2)Fixed – point e.g. Cost DECIMAL (10,2) stores exact value (real)numbersBit field e.g. Bin BIT (4) it represents bit field values.-CharacterCHAR fixed-length character stringVARCHAR variable-length character stringENUM Enumeration consisting of a fixed set of legal valuesSome are:-Binary, Binary data strings-Temporal, Time and DatesCreating a Table (File)The syntax for creating a table is:CREATE TABLE <tablename> (<column name1> <column type> [<column option>],<column name2> <column type> [<column option>],…., ][<list of table constraints and or indexes>]Page | 22 Mr. Saifullahi Muhammad
Lecture NoteIntroduction to File Processing)[<table option>]A table always has a table name (which is the file name) and always has atleastone column (field), other items are optional.Example:CREATE TABLE CountryLanguage (CountryCode CHAR (3) NOT NULL,Language VARCHAR (30) NOT NULL,IsOfficial ENUM (‘True’, ‘False’) NOT NULL DEFAULT ‘False’,Percentage FLOAT (3,1) NOT NULL,PRIMARY KEY (CountryCode, Language))ENGINE = MyISAMCOMMENT = ‘lists language spoken’;We can also create a table LIKE existing one. E.g. CREATE TABLE countryLIKE countryLanguageWe can also create a TEMPORARY table. E.g. CREATE TEMPORARYTABLE newCountry LIKE countryLanguage; or CREATE TEMPORARYTABLE newCountry as SELECT * FROM countryLanguage;Column Options:NULL or NOT NULL: specify the nullability for the column. A nullable column
You've reached the end of your free preview.
Want to read all 30 pages?
Summer '16
teresia
Filename, Filename extension, Computer file, Mr. Saifullahi Muhammad