โ
Core SQL Interview Questions With Answers ๐ฅ๏ธ
1 What is SQL
โข SQL stands for Structured Query Language
โข You use it to read and manage data in relational databases
โข Used in MySQL, PostgreSQL, SQL Server, Oracle
2 What is an RDBMS
โข Relational Database Management System
โข Stores data in tables with rows and columns
โข Uses keys to link tables
โข Example. Customer table linked to Orders table using customer_id
3 What is a table
โข Structured storage for data
โข Rows are records
โข Columns are attributes
โข Example. One row equals one customer
4 What is a primary key
โข Uniquely identifies each row
โข Cannot be NULL
โข No duplicate values
โข Example. user_id in users table
5 What is a foreign key
โข Links one table to another
โข Refers to a primary key in another table
โข Allows duplicate values
โข Example. user_id in orders table
6 Difference between primary key and foreign key
โข Primary key ensures uniqueness
โข Foreign key ensures relationship
โข One table can have one primary key
โข One table can have multiple foreign keys
7 What is NULL
โข Represents missing or unknown value
โข Not equal to zero or empty string
โข Use IS NULL or IS NOT NULL to check
8 What are constraints
โข Rules applied on columns
โข Maintain data quality
โข Common constraints
โ NOT NULL
โ UNIQUE
โ PRIMARY KEY
โ FOREIGN KEY
โ CHECK
9 What are data types
โข Define type of data stored
โข Common types
โ INT for numbers
โ VARCHAR for text
โ DATE for dates
โ FLOAT or DECIMAL for decimals
10 Interview tip you must remember
โข Always explain with a small example
โข Speak logic before syntax
โข Keep answers short and direct
Double Tap โค๏ธ For More
Post #3012
1.28K
- โค 7
- ๐ 1