Skip to content
Advertisement

Simplify nested queries

The above are the nested queries I wrote in sqlite for a relational algebra that outputs the names of the people who coauthored an article with John Doe.

Here’s the relational schema:
Article(aid, title, year, confid, numpages) Author(aid, pid) Person(pid, name, affiliation).
My question how can I simplify the nested queries?

Advertisement

Answer

I don’t see how your question relates to regular expressions at all. If you want the names of the persons that co-authored with John Doe though, I would recommend joins:

The query starts from person John Doe, and brings the corresponding rows in author; then, it searches for all co-authors, and finally brings their names.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement