What is the use of function.php in WordPress
Every theme folder contains one and only one function.php. The purpose of this file is to allow theme developers to define theme features and functions. This file acts just like a WordPress plugin and can be used to add your own custom code snippets in WordPress. Updating your logo, copyright text, footer and header sections. Add custom widget, add new menu or submenu items, defining sidebars and their positions.
For additional information you can see :Click hereHow many tables we have by default in Wordpress?
If you install wordpress (4.1) it will create database with 11 tables. And by default tables are prefix with "wp_".
Defining/creating your own plugins.
Official documentation link for creating custom plugin.
How you can connect Wordpress from outside of wordprss installation?
To use wordpress function and class, first you need to load the wp instance and then use the function on that page. Below is the simple example of getting lastest post from Wrodpress.