sql - PostgreSQL creating enum of enums -


I'm thinking that for example in postgresql there is a way to create an enum enum:

  An animation of animation ('stop-motion', 'CGI', 'motion-capture') is  

and

  is a moviegener  

With this method, I can include something like:

  Ambience (animation, 'fantasy', 'SCAI', 'horror') films ( Name, style) values ​​('donation of planetary planets', 'motion-capture'), ('annabel', 'horror')  

and may

  

ltree the data type will be forwarded, see the documentation. ltree Data type In your case there is an elegant hierarchical structure for label type information. Your label path will be:

  animation animation. Stop-motion animation. CGI Animation. Motion-Capture Fancy Sci-fi horror  

and your related INSERT statement:

  Movie (name, style ) Include in values ​​('Don' of Planes Planet ',' Animation. Motion-Capture '), (' Annabelle, '' Horror ');  

and SELECT statement:

  movies from SELECT * where the style & lt; @ 'Animation';  

This SELECT statement will return all records that are of three animation types.

Note that ltree is an extension, so your superster has to create an extension lottery; If for other purposes he has not done so already.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -