Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

Introduction to SQL


SQL stands for Structured Query Language. It is a standard programming language specifically designed for managing and manipulating relational databases. SQL allows you to perform various operations such as querying data, updating records, deleting rows, and managing database structures.

Key Features of SQL

Examples of SQL Statements

1. Creating a Table

The following SQL command creates a table named Employees:

        CREATE TABLE Employees (
            EmployeeID INT PRIMARY KEY,
            FirstName VARCHAR(50),
            LastName VARCHAR(50),
            Position VARCHAR(50),
            Salary DECIMAL(10, 2)
        );
      

2. Inserting Data into a Table

Use the INSERT INTO statement to add data to the Employees table:

        INSERT INTO Employees (EmployeeID, FirstName, LastName, Position, Salary)
        VALUES (1, 'John', 'Doe', 'Manager', 75000.00);
      

3. Querying Data

To retrieve all records from the Employees table, use the SELECT statement:

        SELECT * FROM Employees;
      

4. Updating Data

You can update a specific employee's salary using the UPDATE statement:

        UPDATE Employees
        SET Salary = 80000.00
        WHERE EmployeeID = 1;
      

5. Deleting Data

To delete an employee from the table, use the DELETE statement:

        DELETE FROM Employees
        WHERE EmployeeID = 1;
      

6. Dropping a Table

To remove the entire Employees table from the database, use the DROP TABLE command:

        DROP TABLE Employees;
      

Conclusion

SQL is an essential tool for anyone working with relational databases. Its straightforward syntax and powerful features make it a versatile choice for managing and manipulating data. By learning SQL, you can perform a variety of tasks efficiently and effectively.



Advertisement

Advertisement

Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java