Query the links Database

WordPress adds prefixes to tables names, which was setup on installation. So by default there is wp_ prefix for tables names. It means that by default table name for links will be wp_links. But you shouldn’t care about standard tables name, because all of them exists as parameters of wpdb class (read Table section), so your query should be built like this:

$sql = "SELECT * FROM " . $wpdb->links; 
$data = $wpdb->get_results($sql);