1 / 8

Creación de tablas

Creación de tablas. Introducción. Creación de tablas Generación de valores de columnas. Creación de tablas. Creación y eliminación de una tabla Agregar y quitar columnas. Nombre de columna. Tipo de datos. NULL o NOT NULL. CREATE TABLE dbo.Categories (CategoryID CategoryName

azuka
Télécharger la présentation

Creación de tablas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creación de tablas

  2. Introducción • Creación de tablas • Generación de valores de columnas

  3. Creación de tablas • Creación y eliminación de una tabla • Agregar y quitar columnas

  4. Nombre de columna Tipo de datos NULL o NOT NULL CREATE TABLE dbo.Categories (CategoryID CategoryName Description Picture int IDENTITY(1,1)nvarchar(15) ntext image NOT NULL,NOT NULL, NULL, NULL) Creación y eliminación de una tabla • Creación de una tabla • Intercalación de columnas • Especificación de NULL o NOT NULL • Columnas calculadas • Eliminación de una tabla

  5. Agregar y quitar columnas ALTER TABLE CategoriesNew ADD Commission money null AGREGAR Customer_name Sales_amount Sales_date Customer ID Commission QUITAR ALTER TABLE CategoriesNew DROP COLUMN Commission

  6. Generación de valores de columnas • Uso de la propiedad Identity • Uso de la función NEWID y el tipo de datos uniqueidentifier

  7. Uso de la propiedad Identity • Requisitos para utilizar la propiedad Identity • Sólo se permite una columna de identidad por tabla • Utilizar con tipos de datos integer, numeric y decimal • Recuperar información acerca de la propiedad Identity • Utilizar IDENT_SEED e IDENT_INCR para información de definición • Utilizar @@identity para determinar el valor más reciente • Administrar la propiedad Identity

  8. Uso de la función NEWID y el tipo de datos uniqueidentifier • Estas características se utilizan juntas • Asegurar valores únicos globales • Utilizar con la restricción DEFAULT CREATE TABLE Customer (CustID uniqueidentifier NOT NULL DEFAULT NEWID(), CustName char(30) NOT NULL)

More Related