{"id":434,"date":"2024-08-28T08:47:57","date_gmt":"2024-08-28T08:47:57","guid":{"rendered":"https:\/\/techkubo.com\/sql\/?p=434"},"modified":"2025-05-27T09:39:36","modified_gmt":"2025-05-27T09:39:36","slug":"create","status":"publish","type":"post","link":"https:\/\/techkubo.com\/sql\/create\/","title":{"rendered":"CREATE"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">SQL CREATE Keyword<\/h2>\n\n\n\n<p>The CREATE keyword is used in SQL to define new objects in the database such as databases tables indexes views and procedures.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE DATABASE Syntax<\/h2>\n\n\n\n<p>The CREATE DATABASE command is used to create a new database.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE DATABASE database_name<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE DATABASE Example<\/h2>\n\n\n\n<p><strong>MySQL \/ SQL Server \/ Oracle \/ MS Access<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE DATABASE EngineDB<\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>Note:<\/em><\/strong> SQLite including our TechKubo playground does not support CREATE DATABASE. Databases are created as separate files outside SQL through the system or interface.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE TABLE Syntax<\/h2>\n\n\n\n<p>The CREATE TABLE command is used to create a new table in the database.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE TABLE table_name (\n    column1 datatype,\n    column2 datatype,\n    ...\n)<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE TABLE Example<\/h2>\n\n\n\n<p>This creates a table named Vehicles with five columns.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE TABLE Vehicles (\n    VehicleID INT,\n    Brand VARCHAR(255),\n    EngineSize INT,\n    FuelType VARCHAR(100),\n    Origin VARCHAR(255)\n)<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"222\" src=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png\" alt=\"\" class=\"wp-image-1347\" style=\"width:998px;height:auto\" srcset=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png 1024w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-300x65.png 300w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-768x167.png 768w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1536x333.png 1536w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png 1697w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"#sql-create-labs\">Try It Out!<\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE TABLE Using Another Table Syntax<\/h2>\n\n\n\n<p>The CREATE TABLE AS statement creates a new table by copying columns and data from an existing table.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE TABLE new_table AS\nSELECT column1 column2\nFROM existing_table<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE TABLE Using Another Table Example<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE TABLE PopularBrands AS\nSELECT Brand FuelType\nFROM Vehicles<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"229\" src=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133-1024x229.png\" alt=\"\" class=\"wp-image-1348\" style=\"width:1004px;height:auto\" srcset=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133-1024x229.png 1024w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133-300x67.png 300w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133-768x172.png 768w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133-1536x344.png 1536w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-133.png 1701w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>Note:<\/em><\/strong> This syntax will work in SQLite only if the source table and data exist. You may need to insert sample data first before seeing results.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE INDEX Syntax<\/h2>\n\n\n\n<p>The CREATE INDEX command is used to speed up searches on a table. Indexes can be created on one or more columns.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE INDEX index_name\nON table_name (column1 column2 ...)<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE INDEX Example<\/h2>\n\n\n\n<p>This creates an index on the Brand column in the Vehicles table.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE INDEX idx_brand\nON Vehicles (Brand)<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"214\" src=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134-1024x214.png\" alt=\"\" class=\"wp-image-1349\" style=\"width:1007px;height:auto\" srcset=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134-1024x214.png 1024w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134-300x63.png 300w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134-768x160.png 768w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134-1536x321.png 1536w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-134.png 1686w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>Note:<\/em><\/strong> Index creation is supported in SQLite. Keep in mind that indexes make queries faster but may slow down inserts and updates.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE UNIQUE INDEX Syntax<\/h2>\n\n\n\n<p>The CREATE UNIQUE INDEX command creates an index that does not allow duplicate values.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE UNIQUE INDEX index_name\nON table_name (column)<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE UNIQUE INDEX Example<\/h2>\n\n\n\n<p>This ensures that each VehicleID is unique in the table.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE UNIQUE INDEX uidx_vehicleid\nON Vehicles (VehicleID)<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"218\" src=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135-1024x218.png\" alt=\"\" class=\"wp-image-1350\" style=\"width:1011px;height:auto\" srcset=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135-1024x218.png 1024w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135-300x64.png 300w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135-768x164.png 768w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135-1536x328.png 1536w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-135.png 1693w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE VIEW Syntax<\/h2>\n\n\n\n<p>The CREATE VIEW command defines a virtual table based on a SELECT query.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE VIEW view_name AS\nSELECT column1 column2\nFROM table_name\nWHERE condition<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE VIEW Example<\/h2>\n\n\n\n<p>This creates a view showing only vehicles from Japan.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE VIEW JapaneseVehicles AS\nSELECT Brand EngineSize\nFROM Vehicles\nWHERE Origin = 'Japan'<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"218\" src=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136-1024x218.png\" alt=\"\" class=\"wp-image-1351\" style=\"width:1031px;height:auto\" srcset=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136-1024x218.png 1024w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136-300x64.png 300w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136-768x164.png 768w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136-1536x327.png 1536w, https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-136.png 1700w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE OR REPLACE VIEW Example<\/h2>\n\n\n\n<p>The CREATE OR REPLACE VIEW command updates an existing view with a new definition.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE OR REPLACE VIEW JapaneseVehicles AS\nSELECT Brand EngineSize FuelType\nFROM Vehicles\nWHERE Origin = 'Japan'<\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>Note:<\/em><\/strong> This example is not supported in SQLite. SQLite supports only CREATE VIEW and requires manually dropping the view before recreating it.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE Query the View Example<\/h2>\n\n\n\n<p>To use a view simply query it as if it were a table.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">SELECT * FROM Vehicles<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE PROCEDURE Syntax<\/h2>\n\n\n\n<p>The CREATE PROCEDURE command creates a stored procedure. A procedure is a saved SQL block that can be executed repeatedly.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE PROCEDURE procedure_name\nAS\nSQL statements<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL CREATE PROCEDURE Example<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">CREATE PROCEDURE SelectAllVehicles\nAS\nSELECT * FROM Vehicles\nGO<\/pre><\/div>\n\n\n\n<p><strong>Execute procedure<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">EXEC SelectAllVehicles<\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>Note:<\/em><\/strong> SQLite does not support stored procedures. This feature is available only in MySQL SQL Server Oracle and similar systems.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"sql-create-labs\">SQL CREATE Labs<\/h2>\n\n\n\n<iframe src=\"https:\/\/www.techkubo.com\/sql-sim.html\" title=\"Try SQL on TechKubo\" width=\"100%\" height=\"500\"><\/iframe>\n","protected":false},"excerpt":{"rendered":"<p>SQL CREATE Keyword The CREATE keyword is used in SQL to define new objects in the database such as databases [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-434","post","type-post","status-publish","format-standard","hentry","category-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CREATE - SQL Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techkubo.com\/sql\/create\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CREATE - SQL Tutorial\" \/>\n<meta property=\"og:description\" content=\"SQL CREATE Keyword The CREATE keyword is used in SQL to define new objects in the database such as databases [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techkubo.com\/sql\/create\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-28T08:47:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-27T09:39:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1697\" \/>\n\t<meta property=\"og:image:height\" content=\"368\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Manong\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manong\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/\"},\"author\":{\"name\":\"Manong\",\"@id\":\"https:\/\/techkubo.com\/sql\/#\/schema\/person\/b4fa2f01fa4ff2a4e98276ce47115965\"},\"headline\":\"CREATE\",\"datePublished\":\"2024-08-28T08:47:57+00:00\",\"dateModified\":\"2025-05-27T09:39:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/\"},\"wordCount\":409,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/techkubo.com\/sql\/#organization\"},\"image\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png\",\"articleSection\":[\"SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/techkubo.com\/sql\/create\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/techkubo.com\/sql\/create\/\",\"url\":\"https:\/\/techkubo.com\/sql\/create\/\",\"name\":\"CREATE - SQL Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/techkubo.com\/sql\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png\",\"datePublished\":\"2024-08-28T08:47:57+00:00\",\"dateModified\":\"2025-05-27T09:39:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/techkubo.com\/sql\/create\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#primaryimage\",\"url\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png\",\"contentUrl\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png\",\"width\":1697,\"height\":368},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/techkubo.com\/sql\/create\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/techkubo.com\/sql\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CREATE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/techkubo.com\/sql\/#website\",\"url\":\"https:\/\/techkubo.com\/sql\/\",\"name\":\"SQL Tutorial\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/techkubo.com\/sql\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/techkubo.com\/sql\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/techkubo.com\/sql\/#organization\",\"name\":\"SQL Tutorial\",\"url\":\"https:\/\/techkubo.com\/sql\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techkubo.com\/sql\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2025\/01\/cropped-Techkubo-logo-1.png\",\"contentUrl\":\"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2025\/01\/cropped-Techkubo-logo-1.png\",\"width\":1618,\"height\":1174,\"caption\":\"SQL Tutorial\"},\"image\":{\"@id\":\"https:\/\/techkubo.com\/sql\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/techkubo.com\/sql\/#\/schema\/person\/b4fa2f01fa4ff2a4e98276ce47115965\",\"name\":\"Manong\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techkubo.com\/sql\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21a7455736c21887b8fefe0935012d65?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21a7455736c21887b8fefe0935012d65?s=96&d=mm&r=g\",\"caption\":\"Manong\"},\"sameAs\":[\"https:\/\/techkubo.com\"],\"url\":\"https:\/\/techkubo.com\/sql\/author\/manong\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CREATE - SQL Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techkubo.com\/sql\/create\/","og_locale":"en_US","og_type":"article","og_title":"CREATE - SQL Tutorial","og_description":"SQL CREATE Keyword The CREATE keyword is used in SQL to define new objects in the database such as databases [&hellip;]","og_url":"https:\/\/techkubo.com\/sql\/create\/","og_site_name":"SQL Tutorial","article_published_time":"2024-08-28T08:47:57+00:00","article_modified_time":"2025-05-27T09:39:36+00:00","og_image":[{"width":1697,"height":368,"url":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png","type":"image\/png"}],"author":"Manong","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Manong","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techkubo.com\/sql\/create\/#article","isPartOf":{"@id":"https:\/\/techkubo.com\/sql\/create\/"},"author":{"name":"Manong","@id":"https:\/\/techkubo.com\/sql\/#\/schema\/person\/b4fa2f01fa4ff2a4e98276ce47115965"},"headline":"CREATE","datePublished":"2024-08-28T08:47:57+00:00","dateModified":"2025-05-27T09:39:36+00:00","mainEntityOfPage":{"@id":"https:\/\/techkubo.com\/sql\/create\/"},"wordCount":409,"commentCount":0,"publisher":{"@id":"https:\/\/techkubo.com\/sql\/#organization"},"image":{"@id":"https:\/\/techkubo.com\/sql\/create\/#primaryimage"},"thumbnailUrl":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png","articleSection":["SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techkubo.com\/sql\/create\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techkubo.com\/sql\/create\/","url":"https:\/\/techkubo.com\/sql\/create\/","name":"CREATE - SQL Tutorial","isPartOf":{"@id":"https:\/\/techkubo.com\/sql\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techkubo.com\/sql\/create\/#primaryimage"},"image":{"@id":"https:\/\/techkubo.com\/sql\/create\/#primaryimage"},"thumbnailUrl":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132-1024x222.png","datePublished":"2024-08-28T08:47:57+00:00","dateModified":"2025-05-27T09:39:36+00:00","breadcrumb":{"@id":"https:\/\/techkubo.com\/sql\/create\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techkubo.com\/sql\/create\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techkubo.com\/sql\/create\/#primaryimage","url":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png","contentUrl":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2024\/08\/image-132.png","width":1697,"height":368},{"@type":"BreadcrumbList","@id":"https:\/\/techkubo.com\/sql\/create\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techkubo.com\/sql\/"},{"@type":"ListItem","position":2,"name":"CREATE"}]},{"@type":"WebSite","@id":"https:\/\/techkubo.com\/sql\/#website","url":"https:\/\/techkubo.com\/sql\/","name":"SQL Tutorial","description":"","publisher":{"@id":"https:\/\/techkubo.com\/sql\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techkubo.com\/sql\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techkubo.com\/sql\/#organization","name":"SQL Tutorial","url":"https:\/\/techkubo.com\/sql\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techkubo.com\/sql\/#\/schema\/logo\/image\/","url":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2025\/01\/cropped-Techkubo-logo-1.png","contentUrl":"https:\/\/techkubo.com\/sql\/wp-content\/uploads\/sites\/3\/2025\/01\/cropped-Techkubo-logo-1.png","width":1618,"height":1174,"caption":"SQL Tutorial"},"image":{"@id":"https:\/\/techkubo.com\/sql\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/techkubo.com\/sql\/#\/schema\/person\/b4fa2f01fa4ff2a4e98276ce47115965","name":"Manong","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techkubo.com\/sql\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21a7455736c21887b8fefe0935012d65?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21a7455736c21887b8fefe0935012d65?s=96&d=mm&r=g","caption":"Manong"},"sameAs":["https:\/\/techkubo.com"],"url":"https:\/\/techkubo.com\/sql\/author\/manong\/"}]}},"_links":{"self":[{"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/posts\/434"}],"collection":[{"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":4,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":1396,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/posts\/434\/revisions\/1396"}],"wp:attachment":[{"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techkubo.com\/sql\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}