Tag: structured query language in database management system

SQL server table Describe (DESC) equivalent

Microsoft SQL Server doesn’t seem have a describe command and usually, folks seem to want to build a stored procedure to get the describe behaviors.  However, this is not always practical based on your permissions. So, the simple SQL below will provide describe like information in a pinch.  You may want to dress it up a bit; but I usually just use it raw, as shown below by adding the table name. Describe T-SQL Equivalent Select *   From INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME = ‘<<TABLENAME>>’; Related References Microsoft SQL Server – Useful links SQL Server – Basic SQL Server Object Naming

Continue reading

Database – What is TCL?

TCL (Transaction Control Language) statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions. The main TCL commands are: COMMIT SAVEPOINT ROLLBACK SET TRANSACTION Related References Database Table Field Ordering Effective Practices Structured Query Language (SQL) Tuning What is DDL? What is DML? What is DCL?  

Continue reading

Database – What is a foreign key?

Definition of a Foreign Key A foreign Key (FK) is a constraint that references the unique primary key (PK) of another table. Facts About Foreign Keys Foreign Keys act as a cross-reference between tables linking the foreign key (Child record) to the Primary key (parent record) of another table, which establishing a link/relationship between the table keys Foreign keys are not enforced by all RDBMS The concept of referential integrity is derived from foreign key theory Because Foreign keys involve more than one table relationship, their implementation can be more complex than primary keys A foreign-key constraint implicitly defines an

Continue reading

Database – What is a Composite Primary Key?

What is a Composite Primary Key? A Composite Primary key is Primary key What a primary key, which is defined by having multiple fields (columns) in it.  Like a Primary Key what a composite Primary Key is depends on the database.  Essentially a Composite Primary Key: Is a combination of Fields (columns) which uniquely identifies every row. Is an index in database systems which use indexes for optimization Is a type of table constraint Is applied with a data definition language (DDL) alter command And may define parent-Child relationship between tables Related References Database – What is a Primary Key?

Continue reading

Database – What is a Primary Key?

What is a primary Key? What a primary key is depends, somewhat, on the database.  However, in its simplest form a primary key: Is a field (Column) or combination of Fields (columns) which uniquely identifies every row. Is an index in database systems which use indexes for optimization Is a type of table constraint Is applied with a data definition language (DDL) alter command And, depending on the data model can, define parent-Child relationship between tables Related References Data Modeling – Fact Table Effective Practices Data Modeling – Dimension Table Effective Practices Netezza / PureData Table Documentation Practices Database Table

Continue reading

Database – What is DDL?

What is DDL (Data Definition Language)? DDL (Data Definition Language), are the statements used to manage tables, schemas, domains, indexes, views, and privileges.  The the major actions performed by DDL commands are: create, alter, drop, grant, and revoke. Related References What is DCL? What is DML? Database Table Field Ordering Effective Practices Structured Query Language (SQL) Tuning

Continue reading
%%footer%%