Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Cabayi
.
The CASE statement needed for getting the name of the namespace given its number.
Toggle Highlighting
SQL
SELECT CASE WHEN pl_namespace = 0 THEN '(Main/Article)' WHEN pl_namespace = 1 THEN 'Talk' WHEN pl_namespace = 2 THEN 'User' WHEN pl_namespace = 3 THEN 'User talk' WHEN pl_namespace = 4 THEN 'Wikipedia' WHEN pl_namespace = 5 THEN 'Wikipedia talk' WHEN pl_namespace = 6 THEN 'File' WHEN pl_namespace = 7 THEN 'File talk' WHEN pl_namespace = 8 THEN 'MediaWiki' WHEN pl_namespace = 9 THEN 'MediaWiki talk' WHEN pl_namespace = 10 THEN 'Template' WHEN pl_namespace = 11 THEN 'Template talk' WHEN pl_namespace = 12 THEN 'Help' WHEN pl_namespace = 13 THEN 'Help talk' WHEN pl_namespace = 14 THEN 'Category' WHEN pl_namespace = 15 THEN 'Category talk' WHEN pl_namespace = 100 THEN 'Portal' WHEN pl_namespace = 101 THEN 'Portal talk' WHEN pl_namespace = 118 THEN 'Draft' WHEN pl_namespace = 119 THEN 'Draft talk' WHEN pl_namespace = 710 THEN 'TimedText' WHEN pl_namespace = 711 THEN 'TimedText talk' WHEN pl_namespace = 828 THEN 'Module' WHEN pl_namespace = 829 THEN 'Module talk' WHEN pl_namespace = 108 THEN 'Book' WHEN pl_namespace = 109 THEN 'Book talk' WHEN pl_namespace = 446 THEN 'Education Program' WHEN pl_namespace = 447 THEN 'Education Program talk' WHEN pl_namespace = 2300 THEN 'Gadget' WHEN pl_namespace = 2301 THEN 'Gadget talk' WHEN pl_namespace = 2302 THEN 'Gadget definition' WHEN pl_namespace = 2303 THEN 'Gadget definition talk' WHEN pl_namespace = -1 THEN 'Special' WHEN pl_namespace = -2 THEN 'Media' END AS namespace FROM pagelinks LIMIT 25
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...