SQL DDL, DQL, DML, DCL and TCL Commands

This statement is used to drop an existing table or a database. The GRANT, REVOKE, ANALYZE, AUDIT, and COMMENT commands do not require exclusive access to the specified object. For example, you can basis sql analyze a table while other users are updating the table. DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system.

  • In an era when massive volumes of data are generated, there is a constant need to manage data in databases.
  • The ‘SELECT INTO’ statement is used to copy data from one table to another.
  • Using INNER JOIN with a condition is much faster than using WHERE clauses with conditions.
  • It helps in controlling access to information stored in a database.

Secondly, it eliminates the need to specify how to reach a record, i.e., with or without an index. Fundamentally, queries are utilized to discover explicit information by separating explicit criteria. The query can likewise compute or outline information, just as mechanize information the executive’s errands. Different query incorporates parameter, aggregates, crosstab, influence table, to annex, refresh and erase. Semicolon is the standard way to separate each SQL statement in database
systems that allow more than one SQL statement to be executed in the same call
to the server. In this type of sub-query user needs to use multi-row operators like IN,Any.

SQL Server Tutorial – Everything You Need To Master Transact-SQL

A Trigger is sort of an ‘event listener’ – i.e, it’s a pre-specified set of instructions that execute when a certain event occurs. The list of defined triggers can be viewed using the following query. The following SQL query lists all the fields in a table’s primary key. The standard syntax of selecting attributes from a table is applicable to views as well. The AVG() function computes the average of non-NULL values in a column.

Types of SQL queries

This command helps you to select the attribute based on the condition described by the WHERE clause. DCL commands are used to grant and take back authority from any database user. Firstly there’s an asterisk in place of specifying a column. What it does is signal to the DBMS that the user has requested all the data in the table, i.e. entry of every column for every row.

CREATE VIEW

The ALL operator is used with a WHERE or HAVING clause and returns TRUE if all of the subquery values meet the condition. There are mainly 7 types of Keys, that can be considered in a database. I am going to consider the below tables to explain to you the various keys. Data definition statement are use to define the database structure or table. Using this command, the permissions of John like query or insert on accounts database objects has been removed.

This command is used to delete the information present in the table but does not delete the table. So, once you use this command, your information will be lost, but not the table. This command retrieves the names and ages of students who are over 18 years old from the “students” table. Data manipulation statement are use for managing data within table object.

Leave a Comment

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