I am trying to figure out how to structure some queries, and I am a bit lost. 

Tables:

```
CREATE TABLE dv_customer(
   customer_id INTEGER PRIMARY KEY,
   first_name VARCHAR(50),
   last_name VARCHAR(50),
   email VARCHAR(50),
   address_id INTEGER,
   active BOOLEAN
);

CREATE TABLE dv_address(
    address_id INTEGER PRIMARY KEY,
    address VARCHAR(50),
    address2 VARCHAR(50),
    district VARCHAR(50),
    city_id INTEGER,
    postal_code VARCHAR(50),
    phone VARCHAR(50)
);

CREATE TYPE MPAA_RATING AS ENUM(
'G',
'PG',
'PG-13',
'R',
'NC-17'
);

CREATE TABLE dv_film(
    film_id INTEGER PRIMARY KEY,
    title VARCHAR(50),
    description TEXT,
    length SMALLINT,
    rating MPAA_RATING,
    release_year SMALLINT
);

CREATE TABLE cb_customers(
    last_name VARCHAR(50),
    first_name VARCHAR(50),
    PRIMARY KEY (last_name, first_name)
);

CREATE TABLE cb_books(
    title VARCHAR(50),
    author_id INTEGER,
    edition SMALLINT,
    publisher VARCHAR(50),
    PRIMARY KEY (title, author_id, edition)
);

CREATE TABLE cb_authors(
    author_id INTEGER PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50)
);

CREATE TABLE mg_customers(
    customer_id INTEGER PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    email VARCHAR(50),
    address_id INTEGER,
    active BOOLEAN
);

```

I need to figure out the following Queries:

What are the first and last names of all customers who live in the district having the most customers?

So far:

```
SELECT x.first_name, x.last_name
    FROM dv_customer x, dv_address y    
    WHERE x.address_id = y.address_id 
    AND (SELECT count(district)
    FROM dv_address >= SELECT count(district) FROM dv_address
   );

```

What are the first and last names of the top 10 authors when ranked by the number of books each has written? I want author name and book count, in descending order of book count.

So far:

```
SELECT x.first_name, x.last_name, count(y.title)
    FROM cb_authors x, cb_books y
    GROUP BY first_name, last_name
    ORDER BY count(*) DESC
    LIMIT 10;

```

I know these are a bit of a mess, but they are the only queries I can't seem to figure out. Any help would be appreciated. I am a Postgres noob and just trying to figure out how it works.