cjrefa.blogg.se

Create a view in sqlitestudio
Create a view in sqlitestudio












create a view in sqlitestudio

There are additional aspects of Modifiers, but we will talk about them when we get to them.īecause the Modifier system is so consistent, we can find the linkage between a Modifier and how it is applied by performing a simple LEFT JOIN.CREATE VIEW view_nameĪS select- statement Code language: SQL (Structured Query Language) ( sql )įirst, specify a name for the view. "BeliefModifiers" links Beliefs and Modifiers.

create a view in sqlitestudio

"GovernmentModifiers" is the table that links Governments and Modifiers. "PolicyModifiers" is the table that links Policies and Modifiers. This is usually in a table with a name that ends in "Modifiers." E.g. The linkage of the Modifier, which defines how the Modifier is applied.The Modifier itself, contained in a table called Modifiers.Modifiers generally involve at least 2 components at a minimum: Modifiers are objects that change aspects of the game. Perhaps the most common one you will be using will be reports that refer to the various Modifiers tables throughout the database. Now that we have the basics out of the way, we can talk about some of the more practical queries you will use over and over. Here are the results of running that query: Using that information, SQLiteStudio is able to match those records up when we run our query. For example, above, we are telling the query that Technologies.EraType is a match to Eras.EraType. You will use the portion of the code that follows the ON statement to demonstrate the link between the tables.It may be worth reading some online resources about the differences though if you find this confusing. 99% of the time when writing reports for Civ 6 what you're looking for is a LEFT JOIN. HINT: Don't worry too much about LEFT versus INNER JOIN. INNER JOIN: Will only display records where there is a match between Technologies and EraType.LEFT JOIN: Will find all records where there is a connection, but also not hide any records in Technologies with no match.JOIN will be preceeded by one of two terms: To associate a second table, add your JOIN statement.This is the first table to include in your selection (in this case, Technologies). You write the first part of the SELECT statement as normal.LEFT JOIN Eras ON Technologies.EraType = Eras.EraType For example, consider the Technologies table: Other tables contain references to the EraType in the Eras table. EraType is the PrimaryKey of this table it is the unique way to find any particular record. In most cases, this means taking data from a column in one table then doing a look up using the primary key of that table.įor example, in our report above, we see a list of all of the Eras. JOIN is an instruction to cross-reference data from one table to data in another. To really unlock reports, it is important to understand the concept of the JOIN statement. The report above is useful, perhaps, but it is limited to showing data from a single table (the Eras table). But the tool is free, and we will still be able to generate some very useful views from it, so it is the tool this tutorial will focus on. ( NOTE: If the above SELECT statement is outside your current skill level with SQL, it is recommended you view my starter tutorial on modding with SQLite Studio before proceeding with this lesson.)Ĭompared to some tools out there, SQLiteStudio's report writing features are limited.














Create a view in sqlitestudio