Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
DEMO
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
CREATE TABLE hotel ( hotel_id INT IDENTITY PRIMARY KEY, city_id INT, hotel_name nvarchar(100), created_date date ); CREATE INDEX ix ON hotel(city_id) INCLUDE(created_date, hotel_name); INSERT INTO hotel(city_id, hotel_name,created_date) VALUES (1,N'The Montcalm','1973-01-01'), (1,N'Hotel 41','1998-01-01'), (1,N'The Ritz','1906-01-01'), (2,N'Hôtel de Crillon','1909-01-01'), (2,N'Le Meurice','1815-01-01'); SELECT city_id, MIN(created_date) AS created_date, SUBSTRING(MIN(STR(DATEDIFF(DAY,'0001-01-01',created_date)) + hotel_name), 11, 8000) FROM hotel GROUP BY city_id DROP TABLE hotel
View schema
Execution time: 0,02 sec, rows selected: 2, rows affected: 5, absolute service time: 0,2 sec
edit mode
|
history
city_id
created_date
(No column name)
1
1
01.01.1906 00:00:00
The Ritz
2
2
01.01.1815 00:00:00
Le Meurice