SQL Database

What is SQL Database? In simple database is collection of objects which stores a specific set of structured data. Let us consider an example of Facebook. It needs to store, manipulate, and present data related to members, their friends, member activities, messages, advertisements, and a lot more. These all information is stored in different tables and collection of these tables are kept at one place.   How to CREATE SQL Database? To create a new database in a SQL server use CREATE DATABASE statement. Syntax: CREATE DATABASE DATABASENAME   How to ALTER existing SQL Database? If we want to change the database name or file locations or collations etc. then we use ALTER DATABASE statement. Syntax: ALTER DATABASE { database_name   | CURRENT }   {    MODIFY NAME = new_database_name      | COLLATE collation_name     | < file_and_filegroup_options >     | SET < option_spec ...

SQL Introduction

What is SQL?

SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database. 

SQL is the standard language for Relational Database System.

SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987

 

Why is SQL used?

It is used to manage and organize data in all sorts of systems in which various data relationships exist.

 

What does SQL do?

  • SQL can execute queries against a database
  • SQL can retrieve data from a database
  • SQL can insert records in a database
  • SQL can update records in a database
  • SQL can delete records from a database
  • SQL can create new databases
  • SQL can create new tables in a database
  • SQL can create stored procedures in a database
  • SQL can create views in a database
  • SQL can set permissions on tables, procedures, and views

 

What SQL cannot do?

If we consider queries in relational algebra which cannot be expressed as SQL queries then there are at least two things SQL cannot do. ... E.g.: Relational Division, Relational Comparison and Multiple Assignment. SQL is therefore much more complex but significantly less powerful than the relational algebra.

 

Is SQL difficult to learn?

It is not really difficult to learn SQL.

SQL is not a programming language, it's a query language. ... It is also an English like language so anyone who can use English at a basic level can write SQL query easily. The good news is that most DB engines are compatible with all SQL code.

 

What is RDBMS?

RDBMS stands for Relational Database Management System.

RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.

 

SQL and Procedural Languages

SQL can be extended with procedural languages that allow users to define their own functions and procedures. Therefore, procedural languages are programming languages in either sense of the term.

All database management systems (DBMSs) accept one or more dialects of procedural languages. Let’s have a look at some examples.

PL/SQL, or Procedural Language for SQL, is an extension for SQL in the Oracle database management system. Similar to general-purpose programming languages, PL/SQL includes elements like conditions and loops. With PL/SQL, you can also declare constants, variables, variable types, procedures, and functions.

PL/pgSQL, or Procedural Language/PostgreSQL, is a procedural language supported by the PostgreSQL object-relational database management system. It is very similar to Oracle’s PL/SQL and allows loops and conditions as well as user-defined functions.

MySQL is a database management system that doesn’t have a separate name for SQL extensions that allow the creation of functions and procedures, but it supports this functionality. MySQL has CREATE PROCEDURE AND CREATE FUNCTION STATEMENTS that create stored routines. User-defined functions are also supported in MySQL—they are regarded as externally stored functions.

As you can see, SQL is a powerful tool for data management and access. It can handle huge analytical queries with all kinds of data.


Comments