🔹 Basic Level Questions
- What is MySQL? Difference between SQL and MySQL?
- What is PDO in PHP? Why use it?
- Difference between MySQLi and PDO?
- What is a database table?
- What is a primary key?
- What is AUTO_INCREMENT?
- What is CRUD? Explain each operation.
- How do you connect PHP with MySQL using PDO?
- What is
fetch()vsfetchAll()? - What is
PDO::FETCH_ASSOC?
🔹 Intermediate Level Questions
- What are prepared statements? Why are they important? 🔥
- What is SQL Injection? How do you prevent it?
- Difference between:
bindParam()vsbindValue()
- What is
rowCount()? - How to handle errors in PDO?
- What is
lastInsertId()? - What is the difference between:
requirevsinclude(used in DB connection files)
- What is normalization in database?
- What are indexes in MySQL?
- What is the difference between
INNER JOINandLEFT JOIN?
🔹 Advanced Level Questions
- How does PDO protect against SQL Injection internally?
- What are transactions in PDO? Explain with example.
- Difference between:
commit()rollback()
- How to optimize slow queries in MySQL?
- What is connection pooling?
- What is the difference between:
CHARvsVARCHAR
- What is database locking?
- How do you secure user authentication system in PHP?
- What is hashing? Difference between:
md5()password_hash()🔥
- What are ACID properties in databases?
🔹 Practical Coding Questions (Very Important 🔥)
- Write a PDO query to insert user data securely
- Create a login system using prepared statements
- Fetch all users and display in table
- Update user email using PDO
- Delete a user by ID
- Create a search feature (LIKE query)
- Implement pagination in PHP + MySQL
- Build a secure registration system with hashed passwords
- Write a JOIN query using PDO
- Create a REST API using PHP + PDO
🔥 HR + Scenario-Based Questions
- What will you do if your database is hacked?
- How will you handle 1 million records efficiently?
- How do you design a scalable database?
- How do you debug a slow query?
- What steps will you take to secure a login system?
💡 Pro Tip (Interview Hack)
If you say this line, interviewer gets impressed:
“I always use PDO prepared statements with password_hash() and proper validation to prevent SQL injection and ensure security.”






