What is the difference between MySQL, MySQLi and PDO?

Those are different APIs to access a MySQL backend

  • The mysql is the historical API
  • The mysqli is a new version of the historical API. It should perform better and have a better set of function. Also, the API is object-oriented.
  • PDO_MySQL, is the MySQL for PDO. PDO has been introduced in PHP, and the project aims to make a common API for all the databases access, so in theory you should be able to migrate between RDMS without changing any code (if you don’t use specific RDBM function in your queries), also object-oriented.

So it depends on what kind of code you want to produce. If you prefer object-oriented layers or plain functions…

My advice would be

  1. PDO
  2. MySQLi
  3. mysql
Advertisements

SQL Interview Questions and Answers

SQL Interview Questions and Answers

1) What is SQL? Structured Query Language, a standard language for accessing databases. Using SQL we can Access Oracle, Sybase, DB2, SQL Server, MySQL, DB/400 and other Database Management Systems

2) When SQL was appeared? Structured Query Language was first appeared by IBM in 1974 and it is Free Software (any body can use with free of cost).

3) Who should learn SQL? • Database Developers • Database Testers • Database Administrators

4) What are the Usages of SQL? • Creating new databases • Creating new tables in a database • Inserting records in a database • Updating records in a database • Deleting records from a database • Retrieving data from a database • Executing queries against a database • Creating stored procedures in a database • Creating views in a database • Setting permissions on tables, procedures, and views Etc…

5) What are important SQL Language Elements? Identifiers: Names of Database objects such as tables, views, columns, and databases etc… Data Types: Define the type of data that is contained by a column. Constants: Symbols that represent specific data types. Operators: Perform Arithmetic, Comparison, and Logical Operations. Functions: Built-in Functions to perform specific operations. Clauses: Constituent components of statements and queries. Expressions: Produce either scalar values, or tables consisting of columns and rows of data. Queries: Retrieve the data based on specific criteria. This is an important element of SQL. Statements:

6) What are the sub sets of SQL? • Data Definition Language • Data Manipulation Language • Data Control Language 7) What is Data Definition Language? Data Definition Language (DDL) allows us to create, alter, and delete database objects such as schemas, tables, views, sequences, catalogs, indexes, and aliases.

8) What is Data Manipulation Language? DML is a language which enables users to access and manipulate data. Data Manipulation Language is use8) What is Data Manipulation Language? DML is a language which enables users to access and manipulate data. Data Manipulation Language is used to Perform below Operations: • Insertion of data into the database • Retrieval of data from the database • Updating data in the database • Deletion of data in the database

9) What is Data Control Language? Data Control Language (DCL) allows us to control access to the database. ‘DCL’ commands include- ‘GRANT’ to allow specific users to perform specified tasks ‘REVOKE’ to cancel previously denied or granted permissions

10) What is Database? A database is a systematic collection of data, Databases support storage and manipulation of data, and Databases make data management easy. 11) What is Table? A Table in a Relational Database is a predefined format of rows and columns that define an entity. Each column contains a different type of attribute and each row corresponds to a single record. Each table is provided with a name. 12) What is Database Management System? > A database management system, or DBMS, is software designed to assist in maintaining and utilizing

8) What is Data Manipulation Language? DML is a language which enables users to access and manipulate data. Data Manipulation Language is used to Perform below Operations: • Insertion of data into the database • Retrieval of data from the database • Updating data in the database • Deletion of data in the database 9) What is Data Control Language? Data Control Language (DCL) allows us to control access to the database. ‘DCL’ commands include- ‘GRANT’ to allow specific users to perform specified tasks ‘REVOKE’ to cancel previously denied or granted permissions 10) What is Database? A database is a systematic collection of data, Databases support storage and manipulation of data, and Databases make data management easy. 11) What is Table? A Table in a Relational Database is a predefined format of rows and columns that define an entity. Each column contains a different type of attribute and each row corresponds to a single record. Each table is provided with a name. 12) What is Database Management System? > A database management system, or DBMS, is software designed to assist in maintaining and utilizing

9) What is Data Control Language? Data Control Language (DCL) allows us to control access to the database. ‘DCL’ commands include- ‘GRANT’ to allow specific users to perform specified tasks ‘REVOKE’ to cancel previously denied or granted permissions 10) What is Database? A database is a systematic collection of data, Databases support storage and manipulation of data, and Databases make data management easy. 11) What is Table? A Table in a Relational Database is a predefined format of rows and columns that define an entity. Each column contains a different type of attribute and each row corresponds to a single record. Each table is provided with a name. 12) What is Database Management System? > A database management system, or DBMS, is software designed to assist in maintaining and utilizing large collection of data. > The alternative to using a DBMS is to store the data in files and write application-specific code to manage it. Using a DBMS to manage data has many advantages like: • Data independence • Efficient data access • Data integrity and security • Data administration • Concurrent access and data recovery 13) What is Database Engine? Software that stores and retrieves data in a database. It may be self-contained program or the part of DBMS that performs the storage and retrieval operations. 14) What is Database Server? Database Management Systems provide Database server functionality, database server provides database services to other computer programs or computers. 15) What is MS Access? MS Access was launched in 1992 by Microsoft Corporation as part of MS Office. Microsoft Access is entry-level database management software. It is not only an inexpensive but also powerful database for small-scale projects. MS Access comes with the professional edition of MS Office package. 16) What is Oracle? Oracle is a relational database management system developed by ‘Oracle Corporation and launched in 1977. Oracle supports all major Operating systems includes, MS Windows. NetWare, UnixWare, OS/2 and most UNIX flavors. 17) What is MS SQL Server? MS SQL Server is a Relational Database Management System developed by Microsoft Inc. Its primary query languages are T-SQL and ANSI SQL. 18) What is Sybase? Sybase is a computer software company , their primary product is Sybase DBMS, which is a relational database management system based upon structured query language. 19) What is MySQL? MySQL is open source Database Management System, developed by Swedish company MySQL AB. MySQL Supports many different platforms including Microsoft Windows, UNIX, and Mac OS X. MySQL has free and paid versions, depending on its usage (non-commercial/commercial) and features. 20) What is DB2? DB2 is the short name used for DATABASE 2. It is relational database product developed by IBM. in 1983 21) What is DB/400? It is one of the flavors of IBM DB2