SQL Server T-SQL Statements


As mentioned earlier, the Transact-SQL statements have three categories: DDL statements, DCL statements, and DML statements. Each of the commands in these categories include keywords and parameters that can be used to create, modify, and query SQL Server 2014 databases and tables. The three types are:

  • Data Definition Language (DDL) statements include keywords that you can use to create databases and database objects, modify databases and database objects, and remove databases and database objects. The DDL statements consist of the following keywords: CREATE, ALTER, and DROP. Using these DDL keywords, you can create and modify the structure of your databases and create and modify all kinds of database objects (tables, schemas, indexes, stored procedures, functions, views, triggers, login accounts, database users, server and database roles, credentials, extended events, event notifications, and service broker objects). To execute DDL statements, (and DML) you must have the appropriate permissions to SQL Server and database.
  • Data Manipulation Language (DML) statements are used to insert, update, delete, and query data that is stored in SQL Server database tables. The DML statements consist of the following commands: SELECT, INSERT, BULK INSERT, UPDATE, MERGE, and DELETE.
  • Data Control Language (DCL) statements enable you to grant, deny, and revoke permissions on databases and database objects. The DCL statements include the standard GRANT and REVOKE keywords, as well as the T-SQL DENY statement.

When you are writing your T-SQL code you many find that there are red squiggly lines under your row and table names. In this case you need to refresh SQL Server Intellisense with Ctrl+Shift+R.

Leave a comment

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