click below
click below
Normal Size Small Size show me how
Database Management
Term | Definition |
---|---|
database | A structured collection of records or data stored in a computer system and organized in such a way that it can be searched quickly and information can be retrieved rapidly |
table | A subcontainer within a database that stores the actual data |
row | A single record within a table, which may contain several fields |
column | The name of a field within a row |
root | By default, the initial MySQL user |
SHOW databases; | Command to view all databases using mySQL client |
; (Semi-colon) | Character the ends each mySQL command |
mysql -u root -p | Command to enter at Windows command line to start the mySQL client |
USE database; | mySQL command to make a database the default database used |
DESCRIBE table; | mySQL command to see the format of any table |
VARCHAR | Data Type command takes a numeric value that tells MySQL the maximum length allowed for a string stored in this field which can be varied and contain alphanumeric data but is stored using only the information in the field |
CHAR | Data Type accept text strings and impose a limit on the size of the field with every string in the field has the specified size |
BLOB | Data Type Binary Large OBject is most useful for binary data in excess of 65,536 bytes in size and can be used to hold images |
INT | Data Type that we used to hold only numeric values |
NULL | Field with no value |
AUTO_INCREMENT | a column given this data type will set the value of its contents to that of the column entry in the previously inserted row, plus 1 |
DROP | Command allows you to delete a table or a column from a table |
INSERT | Command used to add data to a table |
* | Wildcard used to match any number of characters |
INDEX | The way to achieve fast searches is to add this to a column |
PRIMARY KEY | single unique key for each row to enable instant accessing of a row |
SELECT | mySQL command to query a database |
DELETE | mySQL command to remove a row from a table |
WHERE | mySQL keyword enables you to narrow down queries by returning only those where a certain expression is true |
LIKE | pattern matching for your searches using this qualifier, which allows searches on parts of strings. This ualifier should be used with a % character before or after some text |
LIMIT | enables you to choose how many rows to return in a query, and where in the table to start returning them |
ORDER BY | Sorts returned results by one or more columns, in ascending or descending order |
DESC | Add this to change the sort order from the default of Ascending to Descending order |
JOIN | mySQL command to combine tables together |
mysqld | mySQL server |
CREATE TABLE dbmgt.test (test_one INT, test_two INT); | Command to create a table called test in the database dbmgt with fields test_one and test_two using INT data type. |
CREATE DATABASE dbmgt; | Command to create the database dbmgt; |
SHOW TABLES; | Command to view tables contained in default database |
USE dbmgt; | Command to make dbmgt the default database |
schema | When creating a table, you specify the fields or columns to be created, called the tables what? |
SQL | Structured Query Language |
UNIQUE | Clause used to make sure each record in a given column is different for each record added |
NOT NULL | ensures that a field has a value entered for each record |
SHOW CREATE TABLE table_name | Command will show table structure and also default server settings |
\c | Can be used to cancel a command before executing it at the mysql prompt |
SET DEFAULT | Allows you to add a given value to a column every time it is created |
TEXT | Data Type that allows you to store over 255 and up to 65,535 bytes of alphanumeric characters. |
BIT | Data Type that stores only 1 or 0, can be used for True/False or Yes/No for example |
RENAME table_1 TO table_2; | Command to rename a table |
ALTER | Command allows you to change any table. Changes include adding column, changing data type of column, change order of data in column, change name of column, add or change an index |
ADD COLUMN | Clause used with ALTER to add a column |
CHANGE COLUMN | Clause used with ALTER to rename a column or change Data Type |
% (percent symbol) | Specify the pattern of any text that starts with or ends with any characters but ends with string specified |
REPLACE | New rows of data will be inserted as they would with an INSERT statement. Any rows with the same key value will replace the matching row already in the table |