Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Oliver Williams
Oliver Williams
6,278 Points

Why do you need SQL for WordPress?

I have seen some WordPress jobs advertised that wanted SQL knowledge. I know that WordPress uses the SQL database but can anyone give specific examples of when using a SQL query would actually be necessary/useful when working with WordPress? Its not something I've ever run into a need to do. I have already done some of the SQL courses on Treehouse so don't think I'll find it hard to make a query, but I can't think of any situations where it would really be a cool/useful thing to do.

3 Answers

Oliver Williams
Oliver Williams
6,278 Points

Hi Cindy, I am primarily interested in custom SQL queries.

Joel Bardsley
Joel Bardsley
31,245 Points

It would be particularly useful for plugin development where you need to add your own tables to the WP database.

As an example, I've previously worked on a WordPress site that had custom functionality to provide a voting system on community-driven projects that were eligible for funding. In order to make the voting fair we had to create new tables in the WP database in order to manage each project and corresponding vote for validity, and then provide separate views for customers (logged in), public (not logged in) and staff members who had extra permissions to remove/report suspicious votes.