require 'pg'
require 'pry'

conn = PG.connect(dbname: 'chinook')

def add_artist(db_conn, name)
  sql = <<-SQL
    INSERT INTO artists (name)
    VALUES ($1) RETURNING id
  SQL

  db_conn.exec_params(sql, [name]).first["id"]
end

def update_artist(db_conn, id, new_name)
  sql = <<-SQL
    UPDATE artists
    SET name=$1
    WHERE id=$2
  SQL
  db_conn.exec_params(sql, [new_name, id])
end
id = add_artist(conn,"Steven and the t-shirts")

update_artist(conn, id, "S7even && le t-shirts")