PHP supports many databases like dBase, Microsft SQL Server, Oracle, etc. But, it also supports databases like filePro, FrontBase and InterBase with ODBC connectivity. ODBC stands for Open Database connectivity, which is a standard that allows user to communicate with other databases like Access and IBM DB2.
Tag Archives: Database
MySQL Drivers
Below given are the some MySQL drivers
- PHP Driver
- JDBC Driver
- ODBC Driver
- C WRAPPER
- PYTHON Driver
- PERL Driver
- RUBY Driver
- CAP11PHP Driver
- Ado.net5.mxj
MySQL SET
A SET is a string object that can have zero or more values, each of which must be chosen from a list of permitted values specified when the table is created. SET column values that consist of multiple set members are specified with members separated by commas (“,”). A consequence of this is that SET member values should not themselves contain commas.
Example
mysql> CREATE TABLE myset (col SET(‘a’, ‘b’, ‘c’, ‘d’));
Query OK, 0 rows affected (0.43 sec)
mysql> select * from myset;
Empty set (0.20 sec)
mysql> insert into myset value(‘p’);
Query OK, 1 row affected, 1 warning (0.23 sec)
mysql> select * from myset;
+——+
| col |
+——+
| |
+——+
1 row in set (0.10 sec)
mysql> insert into myset value(‘a’);
Query OK, 1 row affected (0.18 sec)
mysql> select * from myset;
+——+
| col |
+——+
| |
| a |
+——+
2 rows in set (0.00 sec)
mysql> insert into myset value(‘p,a’);
Query OK, 1 row affected, 1 warning (0.07 sec)
mysql> select * from myset;
+——+
| col |
+——+
| |
| a |
| a |
+——+
3 rows in set (0.00 sec)
MySQL CHAR And VARCHAR
Following are the differences between CHAR and VARCHAR:
- CHAR and VARCHAR types differ in storage and retrieval
- CHAR column length is fixed to the length that is declared while creating table. The length value ranges from 1 and 255
- When CHAR values are stored then they are right padded using spaces to specific length. Trailing spaces are removed when CHAR values are retrieved.
MySQL ENUM
ENUM is a string object used to specify set of predefined values and that can be used during table creation.
CREATE table phpcodez(name ENUM(‘Average’,’Good’,’Excellent’));
MySQL Access Control Lists
An ACL (Access Control List) is a list of permissions that is associated with an object. This list is the basis for MySQL server’s security model and it helps in troubleshooting problems like users not being able to connect.
MySQL keeps the ACLs (also called grant tables) cached in memory. When a user tries to authenticate or run a command, MySQL checks the authentication information and permissions against the ACLs, in a predetermined order.
MySQL SQL Functions
CONCAT(A, B) – Concatenates two string values to create a single string output. Often used to combine two or more fields into one single field.
FORMAT(X, D) – Formats the number X to D significant digits.
CURRDATE(), CURRTIME() – Returns the current date or time.
NOW() – Returns the current date and time as one value.
MONTH(), DAY(), YEAR(), WEEK(), WEEKDAY() – Extracts the given data from a date value.
HOUR(), MINUTE(), SECOND() – Extracts the given data from a time value.
DATEDIFF(A, B) – Determines the difference between two dates and it is commonly used to calculate age
SUBTIMES(A, B) – Determines the difference between two times.
FROMDAYS(INT) – Converts an integer number of days into a date value.
MySQL Nonstandard String Types
Following are Non-Standard string types:
- TINYTEXT
- TEXT
- MEDIUMTEXT
- LONGTEXT
MySQL TRIGGERS
SIX triggers are allowed in MySql table. They are as follows:
- BEFORE INSERT
- AFTER INSERT
- BEFORE UPDATE
- AFTER UPDATE
- BEFORE DELETE and
- AFTER DELETE
MySQL CREATE Objects
Following objects are created using CREATE statement:
- DATABASE
- EVENT
- FUNCTION
- INDEX
- PROCEDURE
- TABLE
- TRIGGER
- USER
- VIEW