Snowflake table create and delete
Home » Snowflake » Snowflake Table Creation and Data Insertion: A Step-by-Step Guide

Snowflake Table Creation and Data Insertion: A Step-by-Step Guide

In this blog, you will learn all about how to create a table in Snowflake and insert data into it.

Post content

Create a Table in Snowflake

Insert Data into Snowflake table

Drop Table in Snowflake

View Table Definition in Snowflake

To create a table in Snowflake, follow the steps below

Step-1: Add a new SQL Worksheet.

Step-2: To select the database and schema in which you want to create a table, write the following SQL query and execute it.

Run the following SQL queries one by one.

USE ROLE SYSADMIN;
USE DATABASE DEVDB;
USE SCHEMA PUBLIC;
Choose Role database and schema

Choose Role database and schema

Step-3: Now, write a CREATE TABLE statement to create a table with the following syntax:

CREATE TABLE table_name (
column1_name data_type,
column2_name data_type,
...
);

Example: Create an employees Table

Run the SQL statement below.

CREATE TABLE employees (
emp_id INT AUTOINCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
salary DECIMAL(10, 2)
);

Insert data into Table

You can insert data into the newly created table using the INSERT INTO statement. Here’s an example:

INSERT INTO employees (first_name, last_name, salary)
VALUES
('Sandeep', 'Raturi', 50000.00),
('David', 'Keyes', 60000.00),
('Mark', 'Smith', 55000.00);

Verify Data Insertion:

To verify that the data was inserted successfully, you can query the table using a SELECT statement:

Select command in snowflake

Select command in snowflake



Drop Table in Snowflake

To drop (delete) a table in Snowflake, you can use the DROP TABLE statement.

DROP TABLE employees;

View Table Definition in Snowflake

Under the Data tab, select Databases and choose Table.

Table definition in Snowflake

Table definition in Snowflake

Thank you for reading this post, and I hope you enjoyed it!

Leave a Reply