Wordpress Queries?

How wordpress linked with PHP and MYSQL. What are the roles of these two?