DDL OPERATIONS: The various DDL commands are CREATE, ALTER and DROP. Let us learn about each DDL Command one by one with examples. CREATE Statement: The CREATE statement in SQL is used to create the database and the database objects like Tables, Views, Sequences, etc. Let us see how a database and table are created in SQL. Creating a database in SQL: Syntax: CREATE DATABASE DatabaseName; Example: CREATE DATABASE Demos; On executing this query, a database named "Demos" is created. Creating Table in SQL: Database is a collection of related tables and other objects. This implies that a table is a part of the database. Now, we have created the "Demos" database. And, we need to create a "Students" table in this database. By default, the master database is selected. Select Demos database from the dropdown list or alternatively you can use the following command: Use Demos; This ...
Popular posts from this blog
Transactions in SQL Server: Understanding Transactions in SQL Server Transactions are essential for maintaining data integrity, both for multiple related operations and when multiple users that update the database concurrently. What a transaction is When to use transactions Understanding ACID properties Design of a Transaction Transaction state Specifying transaction boundaries T-SQL statements allowed in a transaction Local transactions in SQL Server 2012 Distributed transactions in SQL Server 2012 Guidelines to code efficient transactions How to code transactions What Is a Transaction? A transaction is a set of operations performed so all operations are guaranteed to succeed or fail as one unit. Transaction is all or none A common example of a transaction is the process of transferring money from a checking account to a savings account. This involves two operations: Deducting money from the current account and Adding it to the savings...
Database Normalization Normalization Normalization is a process of minimizing redundant data(duplicate) from database by decomposing the columns of a table into multiple tables. This process increases the number of tables in the database but it minimizes the redundant (duplicate), inaccurate and inconsistent data in database. Decomposed tables are connected using relationships (primary keys and foreign keys) to reduce the insert, update and delete anomalies. During normalization process, database designer decides the actual structure of the tables and their relationships. Every table in the database must satisfy all the normal forms. Normal Form Normal form defines a standard which must be followed for a good database design. During normalization process database designer converts the database tables in normal forms and check its functional dependency. Each normal form has some predefined standa...
Comments
Post a Comment