CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
s TEXT,
t TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO test(s) VALUES ('string');
SELECT * FROM test;
UPDATE `notice`
SET `time_update` = ?, `current_value` = ?
WHERE `id` = ? AND `time_update` = `time`;
но я же хочу через RedBean подключение к БДИ кто Вам мешает. Почитайте документацию RedBean в части взаимодействия с базой данных
SELECT id, (c1=1) + (c2=0) + (c3=1) + (c4=1) + (c5=1) + (c6=1) + (c7=1) FROM test
WHERE ((c1=1) + (c2=0) + (c3=1) + (c4=1) + (c5=1) + (c6=1) + (c7=1)) >= 6
;
delete from t
where
exists (
select true
from t tdouble
where
t.user_id = tdouble.user_id
and t.value_1 = tdouble.value_1
and t.value_2 > tdouble.value_2
);
$products_5 = array_slice($products, 0, 5);
$products_more = array_slice($products, 5);
SELECT "conversations".id
FROM "conversations"
JOIN "usersConversations" "uC1" ON "conversations".id = "uC1".conversation_id AND "uC1".user_id = 1
JOIN "usersConversations" "uC2" ON "conversations".id = "uC2".conversation_id AND "uC2".user_id = 2
WHERE "conversations"."isPrivate" = true
ORDER BY "conversations".id DESC
LIMIT 1;
SELECT "conversations".id
FROM "conversations"
WHERE "conversations"."isPrivate" = true
AND EXISTS (SELECT 1 FROM "usersConversations" WHERE "conversations".id = "usersConversations".conversation_id AND "usersConversations".user_id = 1)
AND EXISTS (SELECT 1 FROM "usersConversations" WHERE "conversations".id = "usersConversations".conversation_id AND "usersConversations".user_id = 2)
ORDER BY "conversations".id DESC
LIMIT 1;
TRUNCATE TABLE tbl RESTART IDENTITY;