I have requirement like this, specific country rows can access by only respective owner remaining rows need to be hide in oracle(sql developer) Can any one help me
Create table Locations (I'd int, category varchar2(20, country varchar2(20), owner varchar2(20));
Related
I have two tables in my database that I have created through migration say products and product_variations and the corresponding model is Product and ProductVariation.
In products table I have three columns say id,name and price and in product_variations table I have the variations of the product that have id,variation,stock and one foreign key(Product_id) column references to the id column of the products table. now I want to display a table in such a way that it will mention the product,price ,variation and stock and also the logic is that If a product laready exist in the table it will skip and new products will be added and similarly it will scan the variations table .If a variation not exist it will add and at the same time if a variation already exist it will update the stock and also for a new variation the lowest price will be saved.
Just getting started in PostgreSQL and wanted to ask some questions.
Suppose that I have a table of Vendors. Each Vendors has an attribute called Sales Record, which is a time series data about their sales. For each Vendors, I want to be one associated Sales Record Table that has the timeseries sales data for that specific vendor.
How might I want to code that?
You shouldn't have a table per vendor.
Rather, create one big table for all. The table contains a column like vendor_id that is a foreign key to vendors and identifies to which vendor a record belongs.
If you create an index on vendor_id, searching the big table for the data of a vendor will be efficient.
I have a view in a private schema with several lets say company_id's. For a special use case I want to allow one company to see a subset of this table (for its own data). So I have create a role and a schema 'company_123' and I have created a view in this schema like
create view company_123.transactions_v as
select * from business.all_transactions_v
where company_id = 123;
But unfortunately this view is empty as the user 'company_123' has no select rights on the original view. How could I achieve this requirement?
You will have to grant SELECT permissions to the user on your table.
You can slice the visible rows and columns to the user though and you should be able to solve your problem.
I'm trying to create a report that looks like this:
using a select from this table: (fiddler here for query and data)
CREATE TABLE StudentData
(
id int PRIMARY KEY IDENTITY,
name varchar(30),
subject varchar(30),
currentGrade varchar(2),
targetGrade varchar(2),
note1 varchar(100),
note2 varchar(100),
note3 varchar(100),
UNIQUE (id)
)
Basically I want to display each student on a new page, with their subject split up into sections, and their grades and notes in each of these subject sections.
I am trying to do this within Business Intelligence Development Studio
Any help with how I would go about that would be great, thanks.
I can upload the images now.
First you add a List Tablix to the report with the name and add a TextBox
Add a Parent Group to the list in the Row Group category
Choose name as the Group By Column
You will have two columns, one with the group and another with the TextBox created previously
Add more TextBox with the rest of the columns missing.
Now we're going to set the break on each group, select on the Row Groups section the group name and right click and select Group Properties
Select the Page Break page and then check the option Between each instance of a group
You should have something like this now.
Now let's configure the name to appear to the top of each page, select in the Row Groups section the Details Group and add a Total Before
And after add some TextBox and some colors you will have something like this.
I hope this can help you.
Add a List and set the DataSetName to your existing Dataset. In the Row Groups definition for the list, tell it to Group on id. Add a textbox for the name.
Add another List inside the existing List and set the DataSetName to your existing Dataset. In the Row Groups definition for the list, tell it to Group on subject. Add a textbox for the subject.
Add 2 Tables inside the inner List to present your inner-most tables.
i have to design a user account/profile tables for a university project. The basic idea i have is the following:
a table for user account (email, username, pwd, and a bunch of other fields)
a user profile table.
It seems to me that there are two ways to model a user profile table:
put all the fields in a table
[UserProfileTable]
UserAccountID (FK)
UserProfileID (PK)
DOB Date
Gender (the id of another table wich lists the possible gender)
Hobby varchar(200)
SmallBio varchar(200)
Interests varchar(200)
...
Put the common fields in a table and design an ProfileFieldName table that will list
all fields that we want. For example:
[ProfileFieldNameTable]
ProfileFieldID int (PK)
Name varchar
Name will be 'hobby', 'bio', 'interests' etc...Finally, we will have a table that will associate profiles with profile fields:
[ProfileFieldTalbe]
ProfileFieldID int (PK)
UserProfileID FK FK
FieldContent varchar
'FieldContent' will store a small text about hobbies, the bio of the user, his interests and so on.
This way is extensible, meaning that in this way adding more fields corresponds to an INSERT.
What do you think about this schema?
One drawback is that to gather all profile information of a single user now i have to do a join.
The second drawback is that the field 'FieldContent' is of type varchar. What if i want it to be of another type (int, float, a date, a FK to another table for listboxs etc...)?
I suggest 2nd option would be better,
The drawbacks which you mentioned are not actual drawbacks,
Using JOINS is one of ways to retrieving the data from the 1 or more tables ,
2) 'FieldContent' is of type varchar : I understand that you are going to create only 'FieldContent' for all your other fields
In that case, I suggest that you can have 'FieldContent' for each corresponding fields so that you can give any any kind of Data Type which you wish.
Coming to the first option,
1)If you put all the fields in one table may lead lot of confusion and provides less feasibility to extend later, if any requirements changes
2)There will be lot of redundancy as well.