Topic on Talk:Quarry

Jump to navigation Jump to search

Looking for info about table links

7
Ineuw (talkcontribs)

Is info available on the database table links to other tables? I saw the new schema (very nice) here on MW, and studied the field names but couldn't figure out the links as I have been able. Was there a redesign of the table links in the past couple of years?

Matěj Suchánek (talkcontribs)

What do you mean with "links"? On Quarry, you can use SHOW TABLES; to display all available tables and DESCRIBE some_table; to see the list of columns.

Ineuw (talkcontribs)

You are right. I was used to the old schema where the related fields were graphically linked.

P.S: I found what I was looking for but it was for version 1.20

Matěj Suchánek (talkcontribs)

While I'm more used to the "command" interface, there is also "Database tables" tab on the top the pages on Quarry which provides a link to the page with "Explore database schema" and also to https://sql-optimizer.toolforge.org/ which includes "Schema browser" feature.

Ineuw (talkcontribs)

Is there anyone here can tell me which table to use to link page and user tables? Thanks in advance.

If it's not known, perhaps someone can point me to a list of users' published queries, to study them?

Matěj Suchánek (talkcontribs)

The trick is to normalize spaces/underscores.

Either:

SELECT * FROM page JOIN user ON page_namespace = 2 AND user_name = REPLACE(page_title, '_', ' ')

or

SELECT * FROM user JOIN page ON page_namespace = 2 AND page_title = REPLACE(user_name, ' ', '_')
Ineuw (talkcontribs)

I am just late, but did not forget. Thanks for the great help.