Introduction to SQL

What is SQL?

1) SQL stands for Structured Query Language
2) SQL lets you access and manipulate databases
3) SQL became a standard of the American National Standards Institute (ANSI) in 1986,
and of the International Organization for Standardization (ISO) in 1987

What can SQL do?

1) SQL can execute queries against a database
2) SQL can retrieve data from a database
3) SQL can insert records in a database
4) SQL can update records in a database
5) SQL can delete records from a database
6) SQL can create new databases
7) SQL can create new tables in a database
8) SQL can create stored procedures in a database
9) SQL can create views in a database
10) SQL can set permissions on tables, procedures, and views

Why SQL?

1) Common querying language

As mentioned above, SQL is a standard for database language. It is used by most of the database programs present. (i.e. SQL Server, MYSQL, SQLite, etc.)

2) Easy to learn

Yes, SQL can be considered as an easy language. SQL uses English like language statements, thus most people can easily understand SQL with a basic level of knowledge. Furthermore, SQL is an open-source program so learning resources can be effortlessly found.

3) Efficient and easy methods

SQL is an efficient way of handling data. Complex results can be produced with basic queries. With this simple querying method, data analysis, data manipulation, and data testing can be done easier and faster.

Advantages of SQL :

  • Faster Query Processing –
    Large amount of data is retrieved quickly and efficiently. Operations like Insertion, deletion, manipulation of data is also done in almost no time.
  • No Coding Skills –
    For data retrieval, large number of lines of code is not required. All basic keywords such as SELECT, INSERT INTO, UPDATE, etc are used and also the syntactical rules are not complex in SQL, which makes it a user-friendly language.
  • Standardized Language –
    Due to documentation and long establishment over years, it provides a uniform platform worldwide to all its users.
  • Portable –
    It can be used in programs in PCs, server, laptops independent of any platform (Operating System, etc). Also, it can be embedded with other applications as per need/ requirement /use.
  • Interactive Language –
    Easy to learn and understand, answers to complex queries can be received in seconds.
  • Disadvantages of SQL :

  • Complex Interface –
    SQL has a difficult interface that makes few users uncomfortable while dealing with the database.
  • Cost –
    Some versions are costly and hence, programmers cannot access it.
  • Partial Control –
    Due to hidden business rules, complete control is not given to the database.
  • What To Avoid in SQL :

    You should not build your SQL statements with string concatenation of user input.
    Not only is it vulnerable to injection, but it has caching implications on the server as well (the statement changes, so less likely to get a SQL statement cache hit whereas the bind example is always running the same statement).