The CreatorCon Call for Content is officially open! Get started here.

what is database view?

Sanem
Tera Contributor

how to create database view?and what are the beast practices to use database view

6 REPLIES 6

Community Alums
Not applicable

Hi Sanem,

as already the topic is explained  bit, I'll be short:

Database view is a join of two or more tables where you can have only read access. This is something like a report or a view, where you can see but not touch. No extra licenses here needed, this is not a new table, but rather a query (spaking in PL/SQL this is a virtual table, created by the query (the JOIN query you use).

 

Hope this bring a bit of light here 🙂

 

Cheers,

Joro

Community Alums
Not applicable

Additionally - you cannot join one table 🙂 You can need at least two  segments for a join to work - speaking stricly in ServiceNow terms! Although, you can join a table wth itself, like this (the code below)) :

 

changeCategory : function(previous, cat) {
var dbu = new GlideDBUpdate('cmdb_ci');
var dbq = new GlideDBQuery('cmdb_ci');
dbq.addQuery('category', previous.category.toString());
dbq.addQuery('sys_class_name', cat.name.toString());
dbu.setQuery(dbq);
dbu.setMultiple(true);
dbu.setValue('category', cat.category.toString());
dbu.setValue('subcategory', cat.subcategory.toString());
dbu.execute();
dbu.close();
dbq.close();
},