Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL select dummy data

I have attempted to create some dummy data from a select statement. I can easily create 1 column with 1 dummy data, or 2 columns with 1 dummy data, but how can I go about making 1 column with 2 dummy data(2 rows)?

(No column name)
    dummy1
    dummy2

Select statements that are 1 dummy data per column:

Select 'dummy'

Select 'dummy1','dummy2'
like image 465
Brad Avatar asked Jul 09 '18 16:07

Brad


People also ask

How do you create a dummy data set in SQL?

To use it, navigate to the link and insert a SQL command that defines the tables or use their dummy tables. Then click next and fill out your rows data types and settings for dummy data population. Then click next and generate the data. Wait.

Can I use SELECT without from?

Although the SQL standard doesn't allow a SELECT statement without a FROM clause, pretty much every other database does support the construct of selecting and expression without a FROM clause.

How do you SELECT random values in SQL?

To get a single row randomly, we can use the LIMIT Clause and set to only one row. ORDER BY clause in the query is used to order the row(s) randomly. It is exactly the same as MYSQL. Just replace RAND( ) with RANDOM( ).


1 Answers

Just another option with one or multiple columns

Single Column

Select *
 From  (values ('Dummy1')
              ,('Dummy2')
       ) A(Dummies)

Returns

Dummies
Dummy1
Dummy2

Multiple Columns

Select *
 From  (values ('Dummy1',1)
              ,('Dummy2',2)
       ) A(Dummies,Value)

Returns

Dummies Value
Dummy1  1
Dummy2  2
like image 171
John Cappelletti Avatar answered Oct 18 '22 16:10

John Cappelletti