Test Yojana

Database languages

What is Database languages

Database languages are specialized programming languages used to interact with databases. They enable users to perform various operations such as querying, updating, inserting, and deleting data from databases. There are several types of database languages, each serving specific purposes:

Type Of Daabase Languages

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • Data Control Language (DCL)
  • Transaction Control Language (TCL)
  • Query Languages
  • Programming Languages with Database Connectivity

Data Definition Language (DDL):

  • DDL is used to define the structure and organization of the database schema.
  • Common DDL commands include CREATE (to create database objects like tables, indexes, and views), ALTER (to modify the structure of existing database objects), and DROP (to delete database objects).
CREATE TABLE Employees (
    FirstName VARCHAR(50),
    LastName VARCHAR(50),
    DepartmentID INT,
    Salary DECIMAL(10,2)


DROP TABLE Employees;

Data Manipulation Language (DML):

  • DML is used to manipulate data within the database. It includes commands for querying, inserting, updating, and deleting data.
  • The most common DML command is SQL (Structured Query Language), which is used in relational database management systems (RDBMS) like MySQL, Oracle, SQL Server, and PostgreSQL.
-- Inserting data
INSERT INTO Employees (EmployeeID, FirstName, LastName, DepartmentID, Salary)
VALUES (1, 'John', 'Doe', 101, 50000.00);

-- Updating data
UPDATE Employees
SET Salary = 55000.00
WHERE EmployeeID = 1;

-- Deleting data
WHERE EmployeeID = 1;

Data Control Language (DCL):

  • DCL is used to control access to the database and its objects.
  • DCL commands include GRANT (to give users specific privileges on database objects) and REVOKE (to remove previously granted privileges).
-- Granting privileges

-- Revoking privileges

Transaction Control Language (TCL):

  • TCL is used to manage transactions within the database.
  • TCL commands include COMMIT (to save the changes made by a transaction), ROLLBACK (to undo the changes made by a transaction), and SAVEPOINT (to set a point within a transaction from which to roll back).
-- Starting a transaction

-- Making changes
INSERT INTO Employees (EmployeeID, FirstName, LastName, DepartmentID, Salary)
VALUES (2, 'Jane', 'Smith', 102, 60000.00);

-- Committing the transaction

-- Rolling back changes

Query Languages:

  • These languages are used specifically for querying databases to retrieve information.
  • SQL (Structured Query Language) is the most widely used query language, especially in relational database management systems (RDBMS).
  • Other query languages include:
    • Datalog: A declarative logic-based language used for querying and manipulating relational databases.
    • SPARQL: A query language used to retrieve and manipulate data stored in Resource Description Framework (RDF) format, commonly used in semantic web applications.
-- Basic SQL query
SELECT FirstName, LastName, Salary
FROM Employees
WHERE DepartmentID = 101;

Programming Languages with Database Connectivity:

  • These are general-purpose programming languages that provide libraries or APIs for interacting with databases.
  • Examples include:
    • JDBC (Java Database Connectivity) for Java
    • ADO.NET for .NET languages like C# and VB.NET
    • psycopg2 for Python interacting with PostgreSQL
    • mysqli for PHP interacting with MySQL

Example using Python and SQL:

import sqlite3

# Connect to the database
conn = sqlite3.connect('example.db')

# Create a cursor object
cursor = conn.cursor()

# Execute SQL query
    FirstName TEXT,
    LastName TEXT,
    DepartmentID INT,
    Salary REAL

# Insert data
INSERT INTO Employees (EmployeeID, FirstName, LastName, DepartmentID, Salary)
VALUES (?, ?, ?, ?, ?)
''', (1, 'John', 'Doe', 101, 50000.00))

# Commit changes

# Close connection

    Each of these database languages serves a specific purpose in managing and interacting with databases, providing users with the flexibility and power to work with data effectively.

    These are some of the fundamental DDL commands used in SQL. They are essential for creating, modifying, and managing the structure of database objects, allowing users to define the organization and layout of their data within a database system.

    145 thoughts on “Database languages”

    1. Its like you learn my thoughts! Youu seem to grasp so much approximately this, lile you wrote the e book in it or something.
      I feel that you simply can do with a few p.c.
      to driove the message home a little bit, butt other
      than that, that is fantastic blog. A fantastic read.
      I’ll certainly be back. https://telegra.ph/7-Smartest-Strategies-to-Maximize-your-Winning-in-Online-Casinos-05-09

    2. Greetings I am so excited I found your website, I really found you by
      accident, while I was browsing on Digg for something else,
      Regardless I am here now and would just like to say many thanks
      for a marvelous ppst and a all round exciting blog (I also love the theme/design), I donโ€™t
      have time to read through it all at the moment but I hae bookmarked it and
      also included your RSS feeds, so when I have time I will be basck to read more, Please do keep up the great work. https://663b900b63cfe.site123.me/

    3. Hello this is kinda of off topi but I waas wanting to know if blogs use WYSIWYGeditors
      or if you have to manually code with HTML. I’m starting a blog soon but have no codinng expertise soo Iwanged to get guiance from someone with experience.

      Any help would be enormously appreciated! https://band.us/band/92732543/post/3

    4. Havve yyou ever considered about including a little bit more than just yoour articles?

      I mean, what you say is valuable aand everything.
      However just imagine if you added sme great photos or video clips to give
      your posts more,”pop”! Your content is excellent
      but with pics and videos, this site could undeniably be
      one of the very best in its field. Wonderful blog! https://www.mazafakas.com/user/profile/4174542

    5. Hello there I am so grateful I found yyour blog, I really found you by error, while I was browsing on Askjeeve forr
      something else, Anyhow I am heere now and would just like to
      say kudos for a remarkablee post and a all round enjoyable
      blog (I also love thhe theme/design), I don’t have time to read it all at the minute
      but I have saved it and also included your RSS feeds, so when I have time I
      will be bback tto read more, Please do keep up the great job. https://gametrendss.mystrikingly.com/

    6. I drop a leave a response whenever I appreciate a post
      on a website or iff I have something to valuable
      to contribute to the discussion. Usually
      iit is triggered by the passion communicated in the article I read.

      And after this article Database languages – Test Yojana.
      I was moved enough to drop a comment ๐Ÿ™‚ I do have 2 questions
      for you iif you tend not to mind. Is it simply me or do a few of
      these remarks look like they are coming from brain dead people?
      ๐Ÿ˜› And, if you are posting on additional places, I’d like
      to keep up with you. Would you mak a list every one of your community pages like your twitter feed, Facebook page or linkedin profile? https://go2trevel.mystrikingly.com/

    Leave a Comment

    Your email address will not be published. Required fields are marked *