Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

YugabyteDB profile imageFrits Hoogland
Frits Hoogland forYugabyteDB

Posted on

Create sample YugabyteDB table with data

I keep finding myself looking around for a quick and convenient way to to create a table populated with data.
(the datasets are described as being free to use for testing)

Download 100,000 rows dataset.

curl-L https://github.com/datablist/sample-csv-files/raw/main/files/people/people-100000.zip> people-100000.zipunzip people-100000.zip
Enter fullscreen modeExit fullscreen mode

Download 1,000,000 rows dataset.

curl-L https://github.com/datablist/sample-csv-files/raw/main/files/people/people-1000000.zip> people-1000000.zipunzip people-1000000.zip
Enter fullscreen modeExit fullscreen mode

Create table and import data into YCQL (Cassandra compatible)

createkeyspacesample;usesample;createtablesample_data(indexintprimarykey,user_idtext,first_nametext,last_nametext,sextext,emailtext,phonetext,date_of_birthtext,job_titletext);--copy sample_data from 'people-100000.csv' with header=true;copysample_datafrom'people-1000000.csv'withheader=true;
Enter fullscreen modeExit fullscreen mode

Create table and import data into YSQL (PostgreSQL compatible)

create table sample_data(index int primary key,user_id text,first_name text,last_name text,sex text,email text,phone text,date_of_birth text,job_title text);--\copy sample_data from 'people-100000.csv' csv header;\copy sample_data from 'people-1000000.csv' csv header;
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Open Source Distributed PostgreSQL

Join the Yugabyte Cloud today, and start using a distributed, PostgreSQL-compatible, DBaaS.

More fromYugabyteDB

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp