DDL, types and data mutations
Relational object definition, SQL writes and table lifecycle management.
Logical schema and business types
CREATE TABLE describes columns and types independently of access structures. INT and BIGINT serve numeric identifiers; NVARCHAR represents text dimensions; DECIMAL(precision, scale) defines exact measures. Loads must validate business uniqueness, value domains and dimension-to-fact relationships. Pipeline validation rules must be explicit.
Define objects
CREATE/DROP SCHEMA and CREATE/ALTER/DROP TABLE are available. dbo is the default schema. Columns declare types, optional arguments and NULL/NOT NULL; IDENTITY is available within the engine’s scope. PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK and DEFAULT are unsupported: an Id name or index does not enforce uniqueness. CREATE INDEX is nonunique and accepts one key column.
CREATE SCHEMA reporting;
CREATE TABLE reporting.Notes (Id INT NOT NULL, Libelle NVARCHAR(80));
ALTER TABLE reporting.Notes ADD Montant DECIMAL(19,4);ALTER COLUMN, DROP COLUMN and schema transfer
ALTER TABLE supports ADD, one-column ALTER COLUMN and DROP COLUMN. Existing data must satisfy the new type/nullability; test conversions on a copy first. ALTER SCHEMA new TRANSFER old.object changes schema membership. DROP SCHEMA follows engine checks. Object changes are not automatically grouped into a transactional migration.
Insert and modify explicitly
INSERT VALUES accepts multiple rows and explicit column lists. INSERT SELECT loads query output. UPDATE and DELETE use WHERE; without WHERE they affect all targeted rows. Run these examples only in the development database. Prefer typed binding to constructing SQL strings.
INSERT INTO reporting.Notes (Id, Libelle, Montant) VALUES (1, N'Essai', 12.5000);
UPDATE reporting.Notes SET Montant = 13.0000 WHERE Id = 1;
DELETE FROM reporting.Notes WHERE Id = 1;INSERT SELECT with an absent target
Octaviius extension: INSERT INTO target SELECT may atomically create an absent target table from result columns. This requires dbo even if the user has INSERT elsewhere. It is not general SQL Server SELECT INTO compatibility. Existing targets apply their declared types/rules. Check names and CAST expressions to control created types.
INSERT INTO dbo.CopieVentes
SELECT Id, ClientId, Pays, Montant, Jour FROM dbo.Ventes;TRUNCATE, DROP and transaction limits
TRUNCATE TABLE removes rows by resetting metadata roots and reseeds identity; DROP TABLE removes the object. They are object-management operations, not DELETEs enabled by ordinary write access. Changes publish per statement. BEGIN TRANSACTION, COMMIT and ROLLBACK are unavailable; a later script error does not undo already published statements.