Hi! Could we please enable some services and cookies to improve your experience and our website?
No, thanks.
Okay!
SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
<?php abstract class Character { protected $name; protected $health = 100; private static $maxHealth = 100; public function __construct($name) { $this->name = $name; } // Abstract: all characters MUST define this abstract public function attack(); // Public method: can be called from anywhere public function heal() { $this->health += 10; if ($this->health > self::$maxHealth) { $this->health = self::$maxHealth; } echo "$this->name heals! Health is now $this->health\n"; } // Protected static: can be used in children, but not outside protected static function getMaxHealth() { return self::$maxHealth; } // Private method: only this class can use it private function secretPower() { return "Hidden Force!"; } public function revealSecret() { // This is okay: private method used from inside same class return $this->secretPower(); } } class Player extends Character { public function attack() { return "$this->name attacks with sword!"; } public function showMaxHealth() { // OK: calling protected static method from parent return "Max health is: " . self::getMaxHealth(); } } class Enemy extends Character { public function attack() { return "$this->name attacks with claws!"; } } // Test it out: $player = new Player("Hero"); echo $player->attack() . "\n"; // Hero attacks with sword! echo $player->showMaxHealth() . "\n"; // Max health is: 100 $player->heal(); // Hero heals! Health is now 110 -> capped at 100 echo $player->revealSecret() . "\n"; // Hidden Force! $enemy = new Enemy("Goblin"); echo $enemy->attack() . "\n"; // Goblin attacks with claws! // Invalid use cases (will error if uncommented): // echo $player->secretPower(); ❌ private // echo Character::getMaxHealth(); ❌ protected
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
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)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear