-- name: CreateCountry :one
INSERT INTO countries (
    countrycode,
    countryname
 ) VALUES (
    $1, $2
 ) RETURNING *;

-- name: GetCountry :one
SELECT * FROM countries
WHERE id = $1 LIMIT 1;

-- name: ListCountries :many
SELECT * FROM countries
ORDER BY id LIMIT $1
OFFSET $2;

-- name: AllCountries :many
SELECT * FROM countries;

-- name: UpdateCountry :one
UPDATE countries
  set 
    countrycode= $2,
    countryname= $3
WHERE id = $1
RETURNING *;

-- name: DeleteCountry :exec
DELETE FROM countries WHERE id= $1;

-- name: ImportDialCodes :exec
UPDATE countries
  set 
    dialcodes= $2
WHERE countrycode = $1
RETURNING *;
