User Tools

Site Tools


podoc:view_lens_type_sql_view

Database View Description of "view_lens_type"

Name

view_lens_type

Description

Purpose

Schema

CREATE VIEW view_lens_type AS SELECT lens_type.identifier, manufacturer.name,
        model, variation, s_min_aperture, s_max_aperture,
        s_min_focal_length, s_max_focal_length, manufacturer.url,
        exiftool_lens_id
    FROM lens_type, manufacturer,
         (SELECT identifier AS identifier, VALUE AS s_min_focal_length
        FROM focal_length) AS t_min_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_max_focal_length
        FROM focal_length) AS t_max_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_min_aperture FROM
        aperture) AS t_min_aperture,
         (SELECT identifier AS identifier, VALUE AS s_max_aperture FROM
        aperture) AS t_max_aperture
   WHERE lens_type.manufacturer = manufacturer.identifier
     AND lens_type.min_focal_length = t_min_focal_length.identifier
     AND lens_type.max_focal_length = t_max_focal_length.identifier
     AND lens_type.min_aperture = t_min_aperture.identifier
     AND lens_type.max_aperture = t_max_aperture.identifier
   ORDER BY manufacturer.name, s_min_focal_length, model, variation;

History

Used first

Version 2.5

Used last

Still in use

Change history

= Version 2.5 =

CREATE VIEW view_lens_type AS
  SELECT lens_type.identifier, manufacturer.name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length, manufacturer.url
    FROM lens_type, manufacturer,
         (SELECT identifier AS identifier, VALUE AS s_min_focal_length FROM focal_length) AS t_min_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_max_focal_length FROM focal_length) AS t_max_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_min_aperture FROM aperture) AS t_min_aperture,
         (SELECT identifier AS identifier, VALUE AS s_max_aperture FROM aperture) AS t_max_aperture
   WHERE lens_type.manufacturer = manufacturer.identifier
     AND lens_type.min_focal_length = t_min_focal_length.identifier
     AND lens_type.max_focal_length = t_max_focal_length.identifier
     AND lens_type.min_aperture = t_min_aperture.identifier
     AND lens_type.max_aperture = t_max_aperture.identifier
   ORDER BY manufacturer.name, s_min_focal_length, model, variation;

= Version 2.32 =

-- Convert focal length from a varchar to an integer
--  and aperture to a numeric type
 
DROP VIEW view_lens_type;
 
CREATE VIEW view_lens_type AS SELECT lens_type.identifier, 
manufacturer.name,
        model, variation, s_min_aperture, s_max_aperture,
        s_min_focal_length, s_max_focal_length, manufacturer.url
    FROM lens_type, manufacturer,
         (SELECT identifier AS identifier, VALUE AS s_min_focal_length
        FROM focal_length) AS t_min_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_max_focal_length
        FROM focal_length) AS t_max_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_min_aperture FROM
        aperture) AS t_min_aperture,
         (SELECT identifier AS identifier, VALUE AS s_max_aperture FROM
        aperture) AS t_max_aperture
   WHERE lens_type.manufacturer = manufacturer.identifier
     AND lens_type.min_focal_length = t_min_focal_length.identifier
     AND lens_type.max_focal_length = t_max_focal_length.identifier
     AND lens_type.min_aperture = t_min_aperture.identifier
     AND lens_type.max_aperture = t_max_aperture.identifier
   ORDER BY manufacturer.name, s_min_focal_length, model, variation;

= Version 2.34 =

DROP VIEW view_lens_type;
 
CREATE VIEW view_lens_type AS SELECT lens_type.identifier, manufacturer.name,
        model, variation, s_min_aperture, s_max_aperture,
        s_min_focal_length, s_max_focal_length, manufacturer.url,
        exiftool_lens_id
    FROM lens_type, manufacturer,
         (SELECT identifier AS identifier, VALUE AS s_min_focal_length
        FROM focal_length) AS t_min_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_max_focal_length
        FROM focal_length) AS t_max_focal_length,
         (SELECT identifier AS identifier, VALUE AS s_min_aperture FROM
        aperture) AS t_min_aperture,
         (SELECT identifier AS identifier, VALUE AS s_max_aperture FROM
        aperture) AS t_max_aperture
   WHERE lens_type.manufacturer = manufacturer.identifier
     AND lens_type.min_focal_length = t_min_focal_length.identifier
     AND lens_type.max_focal_length = t_max_focal_length.identifier
     AND lens_type.min_aperture = t_min_aperture.identifier
     AND lens_type.max_aperture = t_max_aperture.identifier
   ORDER BY manufacturer.name, s_min_focal_length, model, variation;
podoc/view_lens_type_sql_view.txt · Last modified: 2007/10/19 20:13 by Luud