SQL Data Types Interview Questions

    Question 1VARCHAR vs CHAR Data Types

    What is the difference between VARCHAR and CHAR data types?

    Question 2INT vs BIGINT Comparison

    What is the difference between INT and BIGINT data types?

    Question 3Numeric Data Type Operations

    In a products table with columns (product_id INT, price DECIMAL(10,2), discount_percent INT), write a query to calculate the final price after applying discount for products with price greater than $100.

    Question 4TEXT vs VARCHAR Length Limits

    What is the difference between TEXT and VARCHAR data types?

    Question 5NULL Data Type Handling

    How do different data types handle NULL values?

    Question 6ENUM Data Type Usage

    What is ENUM data type and when should it be used?

    Question 7Date Function Operations

    Given an orders table with columns (order_id INT, order_date DATE, delivery_date DATE), write a query to find orders where delivery took more than 7 days.

    Question 8String Function with Data Types

    Given a users table with columns (user_id INT, username VARCHAR(50), email VARCHAR(100)), write a query to find all users whose username length is greater than 8 characters.

    Question 9AUTO_INCREMENT and IDENTITY

    What is AUTO_INCREMENT/IDENTITY and which data types support it?

    Question 10Mixed Data Type Conversion

    In an employees table with columns (emp_id INT, salary DECIMAL(10,2), hire_date DATE, is_active BOOLEAN), write a query to show employee ID and years of service for active employees hired before 2020.