{"id":2323,"date":"2025-03-09T09:18:46","date_gmt":"2025-03-09T02:18:46","guid":{"rendered":"https:\/\/www.pgtutorial.com\/?page_id=2323"},"modified":"2025-03-09T09:19:13","modified_gmt":"2025-03-09T02:19:13","slug":"postgresql-create-schema","status":"publish","type":"page","link":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/","title":{"rendered":"PostgreSQL CREATE SCHEMA Statement"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: In this tutorial, you&#8217;ll learn how to create a new schema in a PostgreSQL database using the PostgreSQL\u00a0<code>CREATE SCHEMA<\/code>\u00a0statement.<\/p>\n\n\n\n<p>In PostgreSQL, a schema is a logical namespace that groups database objects like tables, <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-view\/\">views<\/a>, <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-index\/\">indexes<\/a>, <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-sequence\/\">sequences<\/a>, and <a href=\"https:\/\/www.pgtutorial.com\/plpgsql\/plpgsql-functions\/\">functions<\/a>. Schemas allow you to organize database objects efficiently by preventing name conflicts and improving security.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic-postgresql-create-schema-statement\" id='basic-postgresql%c2%a0create-schema%c2%a0statement'>Basic PostgreSQL\u00a0CREATE SCHEMA\u00a0statement <a href=\"#basic-postgresql%c2%a0create-schema%c2%a0statement\" class=\"anchor\" id=\"basic-postgresql%c2%a0create-schema%c2%a0statement\" title=\"Anchor for Basic PostgreSQL\u00a0CREATE SCHEMA\u00a0statement\">#<\/a><\/h2>\n\n\n\n<p>Here&#8217;s the basic syntax for creating a schema:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> &#91;<span class=\"hljs-keyword\">IF<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">EXISTS<\/span>] <span class=\"hljs-built_in\">schema_name<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, specify the name of the schema you want to create.<\/li>\n\n\n\n<li>Second, use the\u00a0<code>IF NOT EXISTS<\/code>\u00a0option to avoid an error when you attempt to create a schema that already exists.<\/li>\n<\/ul>\n\n\n\n<p>The role that executes the&nbsp;<code>CREATE SCHEMA<\/code>&nbsp;statement must have the&nbsp;<code>CREATE<\/code>&nbsp;privilege for the database. Note that superusers bypass this check.<\/p>\n\n\n\n<p>For example, the following statement creates a schema named&nbsp;<code>finance<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> finance;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The role that executes the statement is the owner of the schema.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-a-schema-with-an-owner\" id='creating-a-schema-with-an-owner'>Creating a schema with an owner <a href=\"#creating-a-schema-with-an-owner\" class=\"anchor\" id=\"creating-a-schema-with-an-owner\" title=\"Anchor for Creating a schema with an owner\">#<\/a><\/h2>\n\n\n\n<p>To create a new schema with an owner, you can use the&nbsp;<code>CREATE SCHEMA<\/code>&nbsp;statement with the&nbsp;<code>AUTHORIZATION<\/code>&nbsp;clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> <span class=\"hljs-built_in\">schema_name<\/span>\n<span class=\"hljs-keyword\">AUTHORIZATION<\/span> role_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This statement creates a new schema and assigns the ownership to the&nbsp;<code>role_name<\/code>. The role will have full control over database objects within the schema. For example:<\/p>\n\n\n\n<p>First, create a new role with the&nbsp;<code>LOGIN<\/code>&nbsp;privilege:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">ROLE<\/span> maria\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">LOGIN<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> <span class=\"hljs-string\">'securepassword'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You should replace the <code>securepassword<\/code> with your password.<\/p>\n\n\n\n<p>Second, create a new schema called&nbsp;<code>accounting<\/code>&nbsp;and assign the role&nbsp;<code>maria<\/code>&nbsp;as the owner:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> accounting\n<span class=\"hljs-keyword\">AUTHORIZATION<\/span> maria;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-a-schema-along-with-the-database-objects\" id='creating-a-schema-along-with-the-database-objects'>Creating a schema along with the database objects <a href=\"#creating-a-schema-along-with-the-database-objects\" class=\"anchor\" id=\"creating-a-schema-along-with-the-database-objects\" title=\"Anchor for Creating a schema along with the database objects\">#<\/a><\/h2>\n\n\n\n<p>To create a schema and its database objects at the same time, you use the following syntax:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> <span class=\"hljs-built_in\">schema_name<\/span>\n    <span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> table1 (...)\n    <span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">VIEW<\/span> view1 (...)\n    <span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> index1(...)\n    <span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SEQUENCE<\/span> seq1(...)\n    <span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TRIGGER<\/span> trg1();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>PostgreSQL treats the subcommands as separate commands after the schema is created.<\/p>\n\n\n\n<p>For example, the following statement creates a new schema called&nbsp;<code>productions<\/code>, along with tables:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> productions\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> products (\n   id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">PRIMARY KEY<\/span>,\n   <span class=\"hljs-type\">name<\/span> <span class=\"hljs-type\">VARCHAR<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>\n)\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> orders (\n  id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">PRIMARY KEY<\/span>,\n  order_date <span class=\"hljs-type\">DATE<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>,\n  product_id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>,\n  qty <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that there is no semicolon (<code>;<\/code>) after each subcommand.<\/p>\n\n\n\n<p>The statement is equivalent to the following statements:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">SCHEMA<\/span> productions;\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> productions.products (\n  id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">PRIMARY KEY<\/span>,\n  <span class=\"hljs-type\">name<\/span> <span class=\"hljs-type\">VARCHAR<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>\n);\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> productions.orders (\n  id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">PRIMARY KEY<\/span>,\n  order_date <span class=\"hljs-type\">DATE<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>,\n  product_id <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>,\n  qty <span class=\"hljs-type\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span>\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"summary\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the\u00a0<code>CREATE SCHEMA<\/code>\u00a0statement to create a new schema.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2323\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL CREATE SCHEMA Statement\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2323\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL CREATE SCHEMA Statement\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2269,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2323","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PostgreSQL CREATE SCHEMA Statement<\/title>\n<meta name=\"description\" content=\"In this tutorial, you&#039;ll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL CREATE SCHEMA Statement\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you&#039;ll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/\" \/>\n<meta property=\"og:site_name\" content=\"PostgreSQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-09T02:19:13+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-create-schema\\\/\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-create-schema\\\/\",\"name\":\"PostgreSQL CREATE SCHEMA Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\"},\"datePublished\":\"2025-03-09T02:18:46+00:00\",\"dateModified\":\"2025-03-09T02:19:13+00:00\",\"description\":\"In this tutorial, you'll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-create-schema\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-create-schema\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-create-schema\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Database Administration\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL CREATE SCHEMA Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/\",\"name\":\"PostgreSQL Tutorial\",\"description\":\"Learn PostgreSQL from Scratch\",\"alternateName\":\"PostgreSQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pgtutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL CREATE SCHEMA Statement","description":"In this tutorial, you'll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.","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:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL CREATE SCHEMA Statement","og_description":"In this tutorial, you'll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.","og_url":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/","og_site_name":"PostgreSQL Tutorial","article_modified_time":"2025-03-09T02:19:13+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/","url":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/","name":"PostgreSQL CREATE SCHEMA Statement","isPartOf":{"@id":"https:\/\/www.pgtutorial.com\/#website"},"datePublished":"2025-03-09T02:18:46+00:00","dateModified":"2025-03-09T02:19:13+00:00","description":"In this tutorial, you'll learn how to create a new schema in a PostgreSQL database using the\u00a0CREATE SCHEMA\u00a0statement.","breadcrumb":{"@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-schema\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pgtutorial.com\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Database Administration","item":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/"},{"@type":"ListItem","position":3,"name":"PostgreSQL CREATE SCHEMA Statement"}]},{"@type":"WebSite","@id":"https:\/\/www.pgtutorial.com\/#website","url":"https:\/\/www.pgtutorial.com\/","name":"PostgreSQL Tutorial","description":"Learn PostgreSQL from Scratch","alternateName":"PostgreSQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pgtutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/comments?post=2323"}],"version-history":[{"count":3,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2323\/revisions"}],"predecessor-version":[{"id":2326,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2323\/revisions\/2326"}],"up":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2269"}],"wp:attachment":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/media?parent=2323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}