如何编写条件sql查询?

时间:2015-06-05 09:30:07

标签: mysql

我有一张叫做学生的表:

name age roll_no



X    Y

我想写一个sql查询,如果name =' X'和年龄=' Y'然后插入' Z' to roll_no。 我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

没有插入而是更新。

root 'sessions#login'
  get 'homes/home'
  get '/login' => "sessions#login", :as => "login"
  get '/logout' => "sessions#logout", :as => "logout"
  get '/homes' => "homes#home"
  resources :users
  resources :sessions
  resources :homes
  resources :teachers
  resources :teacher_details
  resources :profiles