Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

SQL_Answers

The document provides an overview of SQL and database concepts, including definitions of SQL, MySQL, DDL, and DML statements. It includes example SQL queries for creating a table, inserting values, and retrieving records based on specific conditions. Additionally, it explains the differences between DELETE and DROP commands, as well as key concepts like Primary Key, Candidate Key, and Alternate Key.

Uploaded by

SOMANSH BHATIA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL_Answers

The document provides an overview of SQL and database concepts, including definitions of SQL, MySQL, DDL, and DML statements. It includes example SQL queries for creating a table, inserting values, and retrieving records based on specific conditions. Additionally, it explains the differences between DELETE and DROP commands, as well as key concepts like Primary Key, Candidate Key, and Alternate Key.

Uploaded by

SOMANSH BHATIA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL and Database Concepts: Questions and Answers

What is SQL?
SQL (Structured Query Language) is a programming language used to manage and manipulate
relational databases.

What is MySQL?
MySQL is an open-source relational database management system (RDBMS) that uses SQL as its
query language.

What are DDL and DML statements?


- DDL (Data Definition Language): Defines and modifies database structure (CREATE, ALTER,
DROP).
- DML (Data Manipulation Language): Manipulates data in a database (INSERT, UPDATE,
DELETE).

SQL query to create a table 'students'


CREATE TABLE students (
student_id INT PRIMARY KEY,
name VARCHAR(100),
age INT
);

SQL query to insert values into 'students'


INSERT INTO students (student_id, name, age)
VALUES (1, 'John Doe', 20);

Display records of students with student_id = 30


SELECT * FROM students WHERE student_id = 30;

Difference between DELETE and DROP


- DELETE: Removes specific rows but retains the structure.
- DROP: Completely removes a table including its structure.

Explain Primary Key, Candidate Key, and Alternate Key


- Primary Key: Unique identifier for a record.
- Candidate Key: A column/set of columns that uniquely identify a record.
- Alternate Key: A candidate key not chosen as the primary key.

SQL query to display students born between 1990 and 2010


SELECT * FROM students WHERE birth_year BETWEEN 1990 AND 2010;

Display records of students with marks > 50


SELECT * FROM students WHERE marks > 50;

You might also like