Questions tagged [sql-view]

A database view is a stored query. Its output automatically updates as underlying table data changes.

A database view does not store data as tables (temporary or otherwise) do; rather, it is a saved query that can be recalled and reused. Its output automatically updates as underlying table data changes.

Reference

990 questions
-2
votes
2 answers

Match records on different columns

I have to match a table of Agents to a table Clients based on a varying number of matching columns, some match on all columns, others only match on one, or two or three; and not the same columns. Examples: Clients table has columns ClientID,…
-2
votes
1 answer

Refering to view values one by one

I have the following code which establishing an SQL connection inside of a project I am working on. What I want to do is to create a for loop which contains a method and every time the loop repeats the method runs with a different value until all…
banjo
  • 7
  • 3
-2
votes
1 answer

Insert into view regrouping multiple tables?

For exercise I have created the following database, I have created a view that shows information from the [user] table and the [address] table Go DROP VIEW IF EXISTS user_all GO CREATE VIEW user_all([name], [sex], [date_of_birth], [account_type],…
Tanuki
  • 183
  • 4
  • 11
-2
votes
2 answers

SQL Trigger for View

I need help with creating a view and then triggers for the following: update salesperson commission(10% of sale), inventory quantity, and customer balance when each invoice line item is entered. This is what I have right now for the view: I got it…
-2
votes
3 answers

How to use IF-ELSE like condition in SQL Views?

I want to use IF-ELSE like condition in SQL View as we know we can't use actual IF-ELSE. Below is an example of how I want to use it: IF EXISTS ( SELECT 1 FROM SomeTable ) SELECT * FROM TableA ELSE SELECT * FROM TableB Also,…
varun kumar dutta
  • 202
  • 1
  • 4
  • 10
-2
votes
1 answer

group values in sql server view

Hi i have a view that contains this: sku quantity price discount 123 4 10 YES 123 1 10 YES 123 1 10 NO the table have a lot of fields thats just a example what im trying to achieve is to group the sku by refering…
alexistkd
  • 906
  • 2
  • 14
  • 34
-2
votes
2 answers

How to restrict the total number of rows a SQL view can return?

I created a view whose definition is SELECT [Some address related columns] FROM TableName. The base table has several million rows. (SQL 2012) I want to make this view available temporarily to a development team that is working on improving…
Monica
  • 55
  • 1
  • 11
-2
votes
1 answer

Update an SQL View when a row is inserted into a table which the view uses

I am working on an SQL View which retrieves data from a View and an SQL table LastTrade and I use a webpage to insert data into the table LastTradeand when I insert a row I want my SQL view updated. my View is as follows CREATE VIEW…
DoIt
  • 3,270
  • 9
  • 51
  • 103
-2
votes
2 answers

Concat VARCHAR2 fields in Oracle DB

For an SQL view I want to concat two fiels of varchar2-type ROW | PNAME | FNAME 1 | JOHN | DOE 2 | (null) | DOE 3 | JOHN | (null) 4 | (null) | (null) The result I want to get is 1 | 'JOHN DOE' 2 | 'DOE' 3 | 'JOHN' 4 |…
stg
  • 2,757
  • 2
  • 28
  • 55
-3
votes
1 answer

mysql moving 2 columns to one reordening the data where not 0

Could this table be re-arranged into one table (using a view ) +----+------+--------+ | id | item1| item2 | +----+------+--------+ | 1 | A | B | | 2 | 0 | B | | 3 | A | 0 | | 4 | 0 | 0 …
user3845661
-3
votes
1 answer

Change layout of view - SQL

I have a view which has balances for nominal codes. I have the nominal code on each row with the periods Jan-Dec in each column I would like to change so that each nominal code has 12 rows (1 for each month) I am creating the query SQL Server…
Jamie hampson
  • 57
  • 1
  • 7
-3
votes
1 answer

Create sql query to inherits value from nearest parent row

I have a self-referenced table called Units that has a "BossId" column refers to manager person . There is business rule to determine the unit's Boss as described below: 1-The unit has its own BossId. (there is no more work) 2-The BossId is null.…
-3
votes
1 answer

How to create a view from multiple tables?

CREATE VIEW Te AS SELECT select sno,sname,dept,'madinah'as universty name from med_std union select sno,sname,dept,'yanbu'as universty name from yun_std
-4
votes
2 answers

What is the difference between a Stored Procedure and a View(Sql Server)?(Repeat)

I know this question is asked so many times but some issue is still not clear to me. Please don't mark it as duplicate. I am little bit confused with View. Is View create a table internally or execute sql query internally when I select data from…
Sopan Maiti
  • 189
  • 1
  • 11
-5
votes
1 answer

MySql Trigger Function about status

I would like to ask a solution for mysql database. since i made database(order) about 3 column named as order_date(datatype - date),expired_date(datatype - date) and status(varchar(10)). as status value are only New and Expired.[as only 'New' input…
1 2 3
65
66