A
A
Alexander Bagirov2015-05-02 15:07:02
PostgreSQL
Alexander Bagirov, 2015-05-02 15:07:02

How to insert values ​​into a Postgresql table?

When installing the Ruby script, the database was automatically created. One of the tables is described like this:
from the schema.rb file

create_table "contests", :force => true do |t|
    t.text     "name",        :null => false
    t.datetime "start",       :null => false
    t.datetime "end",         :null => false
    t.text     "description", :null => false
    t.boolean  "delta",       :null => false
  end

Now you need to insert a row with any values. The main thing is that she was. Please write an example. Confuses the datetime type and its syntax.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jeiwan, 2015-05-02
@alexbagirov

If I understand the question correctly:

Contest.create(name: 'First contest', start: Time.now, end: 10.days.since, description: 'The very first contest', delta: false)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question