#include <iostream>
int main(int argc, char *argv[])
{
char **strings = new char *[2]; // create an array of two character pointers
strings[0] = "hello"; // set the first pointer in the array to "hello"
strings[1] = "world"; // set the second pointer in the array to "world"
// loop through the array and print whatever it points to out with a space
// after it
for (int i = 0; i < 2; ++i) {
std::cout << strings[i] << " ";
}
std::cout << std::endl;
return 0;
}
SELECT USER_ID, (CASE USER_ID WHEN 1 THEN 1 ELSE 0 END) as FIRST_USER FROM USER
SELECT USER_ID, IF(USER_ID = 1, 1, 0) AS FIRST_USER FROM USER
Оператор IF () работает аналогично тройному? : оператор.