Hi! Could we please enable some services and cookies to improve your experience and our website?
No, thanks.
Okay!
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
CREATE TABLE t1 (
created_at DATE
) ;
INSERT INTO t1 VALUES ('2023-02-03'), ('2023-02-25');
CREATE TABLE t2 (
created_at DATE
)
PARTITION BY RANGE (DAYOFMONTH(created_at)) (
PARTITION p1 VALUES LESS THAN (16),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
INSERT INTO t2 VALUES ('2023-02-03'), ('2023-02-25');
SQL Server:
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
MySQL 9.3.0
MariaDB 11.4
MariaDB 11.8
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
SQLite 3
SQLite 3 Preloaded
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
PostgreSQL 16
PostgreSQL 17 + PostGIS
PostgreSQL 17 + PostGIS WorkShop (ReadOnly)
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
RedDatabase 5.0
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
ClickHouse
Run SQL code
Save snippet
ER Diagram
<?php
$tables = ['t1', 't2'];
$sql_statements = [
'SELECT * FROM [TABLE] WHERE created_at IN (?, ?)',
'SELECT * FROM [TABLE] WHERE (created_at = ? OR created_at = ?)'
];
foreach ($tables as $table) {
foreach ($sql_statements as $id => $sql) {
$stmt = $mysqli->prepare(str_replace('[TABLE]', $table, $sql));
$stmt->execute(['2023-02-03', '2023-02-25']);
$result = $stmt->get_result();
echo 'Table: '.$table.'; Statement: '.$id.'; Num rows: '.$result->num_rows."\n";
}
echo "\n";
}
PHP version :
PHP 7.4
PHP 8.0
PHP 8.1
PHP 8.2
PHP 8.3
PHP 8.4
Run PHP Code
Save snippet