Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

EXCEL USERFORM - Command Button "Find next data entry" fails

$
0
0
Hi,

I'm struggling with the following code. For some reasons I can't attach the Excel Workbook to this email.
I have created a Userform including 3 command buttons: Update Database, Find Next entry, Find Previous entry. I can't get my head around the issue. Find next/ previous entry stumble over this code line "lastrow = Sheets("AWP_UPDATE").Range("A" & Rows.Count).End(xlUp).Row"
While Update database doesn't do anything... Still a bit green in the World of macros... Thanks for your help.

Private Sub cmdNext_Click()
lastrow = Sheets("AWP_UPDATE").Range("A" & Rows.Count).End(xlUp).Row
currentrow = currentrow + 1
If currentrow = lastrow + 1 Then
MsgBox ("You have reached the last row of data!")
currentrow = lastrow
End If
txtSub_Activity.Text = Cells(currentrow, 1).Text
txtLEADName.Text = Cells(currentrow, 2).Text
txtActual_Start.Text = Cells(currentrow, 3).Text
txtActual_Completion.Text = Cells(currentrow, 4).Text
txtComments_on_progress.Text = Cells(currentrow, 6).Text
txtQ1.Text = Cells(currentrow, 7).Text
txtQ2.Text = Cells(currentrow, 8).Text
txtQ3.Text = Cells(currentrow, 9).Text
txtQ4.Text = Cells(currentrow, 10).Text
txtAW2018.Text = Cells(currentrow, 11).Text
cbxStatus1.Value = Cells(currentrow, 12).Value
cbxStatus0.Value = Cells(currentrow, 12).Value
End Sub


Private Sub cmdUpdate_Click()
Dim Sub_Activity As String, LEADName As String, Actual_Start As String, Actual_Completion As String, Comment_on_progress As String, Q1 As String, Q2 As String, Q3 As String, Q4 As String, AW2018 As String, Status As String
txtSub_Activity.Text = Cells(currentrow, 1).Text
txtLEADName.Text = Cells(currentrow, 2).Text
txtActual_Start.Text = Cells(currentrow, 3).Text
txtActual_Completion.Text = Cells(currentrow, 4).Text
txtComments_on_progress.Text = Cells(currentrow, 6).Text
txtQ1.Text = Cells(currentrow, 7).Text
txtQ2.Text = Cells(currentrow, 8).Text
txtQ3.Text = Cells(currentrow, 9).Text
txtQ4.Text = Cells(currentrow, 10).Text
txtAW2018.Text = Cells(currentrow, 11).Text
cbxStatus1.Value = Cells(currentrow, 12).Value
cbxStatus0.Value = Cells(currentrow, 12).Value

End Sub

Private Sub cmdPrevious_Click()
currentrow = currentrow - 1
If currentrow > 1 Then
txtSub_Activity.Text = Cells(currentrow, 1).Text
txtLEADName.Text = Cells(currentrow, 2).Text
txtActual_Start.Text = Cells(currentrow, 3).Text
txtActual_Completion.Text = Cells(currentrow, 4).Text
txtComments_on_progress.Text = Cells(currentrow, 6).Text
txtQ1.Text = Cells(currentrow, 7).Text
txtQ2.Text = Cells(currentrow, 8).Text
txtQ3.Text = Cells(currentrow, 9).Text
txtQ4.Text = Cells(currentrow, 10).Text
txtAW2018.Text = Cells(currentrow, 11).Text
cbxStatus1.Value = Cells(currentrow, 12).Value
cbxStatus0.Value = Cells(currentrow, 12).Value
ElseIf currentrow = 1 Then
MsgBox "Now you are in the header row!"
currentrow = currentrow + 1
End If
End Sub

Nesting an If within another If's condition statement

$
0
0
Hi everyone,

This isn't a must, as I can do this the long-winded way, but is it possible/has anyone tried nesting an If statement within the condition of another If Statement in Access? I'm essentially trying to do something like:

If (If Gender = Male Then // Age_x// Else // Age_y End If) < Age_z Then
a
Else
b
End If

So far, I just get a compile error message (expected: expression) every time I try to run nested If statements.. If anyone has any suggestions I'd appreciate it, thanks :)

Help with code to calculate a repeated sales in one day

$
0
0
Dear All

I am new to DQL and was wondering whether some one can help me with the problem below

I have written a script which will find if a customer has shopped more than once in a day. I am choosing a specific day and it is easy to do this.

What I need is to specify one month range and only return customers who have shopped in one day in two or more different departments over the chosen period. For example if a customer have entered the shop on 3rd December of December and shopped in more than two departments then i need see the loyalty number of that customer and where they shopped in that day. If he/she returns another day or another customer have visited a shop in specific day and shopped in more than two departments I need to list the,
I want to return the sales for month of November instead of the specisfic date in my code
The code I have so far is
Code:

     
                Select  bk.LoyaltyNumber, [Sale] = SUM(bk.PriceTOTAL), AreaName_BM
            -- [Shopped] = count(customerLoyaltyNumber)
            From Sales.dbo.SALE_Basket bk
           
            INNER JOIN Sales.dbo.SALE_Line sl  ON sl.Basket_id = bk.Basket_id
           
           
            INNER JOIN Sales_Analytics.map_Siter GSM  ON bk.Site_Code_PHYSICAL = GSM.Site_Code
           
            INNER JOIN Sales.dbo.dim_Calendar cal ON sl.Day_Uid_TRADE = cal.Day_Uid
           
            Where sl.IsTrade = 20 AND sl.ISVoid = 10 and cal.Day_Uid = 20161203 AND bk.CustomerLoyaltyNumber <> 'Null'
           
            Group By GSM.AreaName_BM,  bk.CustomerLoyaltyNumber
           
            ORDER By bk.LoyaltyNumber ASC

Any help is appreciate it. Hoe it is clear what I need to achieve

Run-time error '6': Overflow

$
0
0
Dear friends,
I can not change my software anymore. When I start the Form Editor, I get a Run-time error '6': Overflow.
I tried to reinstall Brilliant 10.5, but the problem still exists.
Any suggestions how to solve this issue?
Thank you for your kind help in advance.
Best regards,

Dirk

VBA Function to change the colour of cell dependent on cell contents vs Named Range

$
0
0
Hi I need some help please

In he attached example sheet, I have a tab "Supplier refs", columns A - C have a named range
In the other tab "Wiper" In column A is the list of suppliers

I need some a function to loop through column A in (Wiper) check the cell contents and reference each cell against the named ranges and colour accordingly as per the example in column B

Regards

Mark

Example.zip
Attached Files

Simple query help

$
0
0
Hello, i am rather new to SQL and im having some struggles with queries. I have a general understanding of some statements. Like SELECT, COUNT, DISTINCT, and FROM. But i have the hardest time when it comes to grouping tables together or using sub queries i get highly confused and ends up leading to frustration and not figuring it out.
I have a database that has two tables both with the exact same columns and almost the same data. Its a database with geoip data.
Columns: visits id, ip, country_code, country_name, region_code, region_name, city, zip_code, time_zone, latitude, longitude, metro_code
So i just have a couple queries i would like help with.
This is what im trying to acheieve.

1.) How many rows/records ipv4 ips vs ipv6?
2.)List some non-US style zips (limit 10)
3.)Top 20 ip's with most visits.
4.)How many rows/records have NULLS/bad data?
5.)Counts of visits in Northern Hemisphere vs Southern Hemisphere

I really appreciate your time and help if there is any. Thanks

OEM 12c emcli command to grab a file from SWLIB

$
0
0
Hi. I'm currently running OEM 12c on RHEL 6 and I'd like to know if there's an emcli command that allows me to read or download a file (ksh script) that's located in the OEM software library (in either a component or a directive). I'm not aware of any verbs that do this explicitly but perhaps there is a way. Many thanks.

Oracle RDBMS 11.2.0.4 characters issue

$
0
0
Hi. I've encountered a problem trying to load the ö character into a varchar2 column in an 11.2.0.4 DB. The character that gets inserted is a '?'. Normally this happens when the characterset of the DB cannot handle a special character, however, the nls_characterset of the DB is UTF8 so there shouldn't be a problem with an 'ö'. The NLS_LANG env variable is set to the same so it shouldn't be a discrepancy with the client characterset. The SQL is being run via an emcli hostcmd. I've tried running the the same SQL via TOAD and it works fine.

Any idea what the cause could be? Thanks.

★ CHEAP ASP.NET CORE 1.1 HOSTING ★ $1/mo | 99.9% Uptime | 24/7 Support

$
0
0


:: CHEAP ASP.NET CORE 1.1 HOSTING WITH ASPHOSTPORTAL.COM ::

Are you tired of endless downtimes? Long support response times? Poor speeds? You don't need to deal with these! You are paying your hard-earned money, why put up with sub-par services??!! Transfer over to ASPHostPortal Solutions and all these issue will go away.

With Min 1000 Mbps connection and our premium hardware, we will make sure your site never feel slow. When you make the switch to ASPHostPortal Solutions the transfer from your previous hosting provider is completely free of charge. We also give you everything you need and more to run your websites smoothly with a professional support team available 24/7 to assist you.

GET IT NOW !!!

=======================

With hundreds of web hosting companies out there, how can you decide which one is best for you?

Here are a few things that make ASPHostPortal differs from the rest.

>> We offer web hosting in 12 different locations. Washington, London, Paris, Frankfurt, Amsterdam, Melbourne, Toronto, Sao Paulo, Chennai, Milan, Hongkong and Singapore.
>> We have the fastest 1,000 Mbps connection backbone in all of our server, say goodbye to SLOW problems.
>> We will give you daily backup service, your data will be safe every time.
>> We offer Cheap Windows and Linux Dedicated Cloud Server Plans, for those who have outgrown shared hosting and want to manage their own server.
>> We have 24/7 support team to solve your issue. Every time we are ready for you.

Switching to us? We have a unique SLA promise if you unsatisfied with our service in first 30 days, we will give your money back.

=======================

:: OUR ASP.NET CORE 1.1 HOSTING PLAN FEATURES ::

Ready to switch your website for the very last time?

HOST INTRO - $1/month
1 GB Hard Drive Space
10 GB Bandwidth
One Domains
Perfect for: personal websites, small blogs

HOST ONE - $5/month
5 GB Hard Drive Space
60 GB Bandwidth
Unlimited Domains
Perfect for: personal websites, small blogs

HOST TWO - $9/month
15 GB Hard Drive Space
150 GB Bandwidth
Unlimited Domains
Perfect for: small business, forums, etc.

HOST THREE - $14/month
50 GB Hard Drive Space
500 GB Bandwidth
Unlimited Domains
Perfect for: busy blogs/forums/image sites

For Order please visit : http://asphostportal.com/ASPNET-Core-1-1-Hosting

=======================

:: ASPHOSTPORTAL SUPPORTED FEATURES ::

>> Support all version of ASP.NET Hosting
>> Support all version of ASP.NET MVC Hosting
>> Support WCF RIA, and all version of Silverlight 5 Hosting
>> Support all version of Visual Studio Hosting
>> Support FULL Trust Mode
>> Support all version of SQL Hosting
>> Support all version of Crystal Report Hosting
>> Support Visual Studio LightSwitch Hosting
>> Support Web Deploy and FTP
>> Support all version of SSRS Hosting
>> Other features such as Wordpress, Joomla, Umbraco, DotNetNuke, Orchard, Drupal, etc

=======================

:: ABOUT US ::

ASPHostPortal is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and SharePoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, ASPHostPortal strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.

Converting Subqueries into Joins

$
0
0
Below is an example schema with 3 tables. I'm trying to run a query that returns all Jobs where all child Shifts are of status 6. If a Job has a child Shift with a status of 5, the Job should not be returned. The proper response for a query from the sample data inserted below is no rows returned.

There is a working query below with the comment "Works". I am trying to refactor the "works" query to use joins instead of subqueries. The query with the comment "Does not work" is my attempt.

Thanks!

Code:

-- begin setup and table creation: only run this section once.

CREATE EXTENSION "uuid-ossp";

CREATE TABLE jobs
(
  id uuid NOT NULL DEFAULT uuid_generate_v4(),
  CONSTRAINT jobs_pkey PRIMARY KEY (id)
);

CREATE TABLE bookings
(
  id uuid NOT NULL DEFAULT uuid_generate_v4(),
  job_id uuid,
  CONSTRAINT bookings_pkey PRIMARY KEY (id)
);

CREATE TABLE shifts
(
  id uuid NOT NULL DEFAULT uuid_generate_v4(),
  booking_id uuid,
  status integer,
  CONSTRAINT shifts_pkey PRIMARY KEY (id)
);

insert into jobs (id) values ('e857c86c-bc31-11e6-9aae-57793f585d49');

insert into bookings (id, job_id) values ('736da82c-bc32-11e6-b9b8-f36753d321ac', 'e857c86c-bc31-11e6-9aae-57793f585d49');
insert into bookings (id, job_id) values ('7d839e5c-bc32-11e6-8bb3-4fa95be86a74', 'e857c86c-bc31-11e6-9aae-57793f585d49');

insert into shifts (booking_id, status) values ('736da82c-bc32-11e6-b9b8-f36753d321ac', 6);
insert into shifts (booking_id, status) values ('7d839e5c-bc32-11e6-8bb3-4fa95be86a74', 5);

-- end setup and table creation

-- We want all jobs where all child shifts are of status 6.  If a job has a child shift with a status of 5, the job should not be returned.  The proper response for a query from the sample data inserted above is no rows returned.

-- Does not work :(
--SELECT "jobs".* FROM "jobs" inner join bookings b1 on jobs.id = b1.job_id inner join shifts s1 on b1.id = s1.booking_id left outer join bookings b2 on jobs.id = b2.job_id left outer join shifts s2 on b2.id = s2.booking_id and s2.status IN (2,3,4,5) WHERE s1.status = 6 AND s2.id IS NULL GROUP BY "jobs"."id";

-- Works
SELECT "jobs".* FROM "jobs" WHERE (jobs.id IN ( SELECT job_id FROM bookings WHERE bookings.id IN ( SELECT booking_id FROM shifts WHERE status = 6 ) ) AND jobs.id NOT IN ( SELECT job_id FROM bookings WHERE bookings.id IN ( SELECT booking_id FROM shifts WHERE status IN (2,3,4,5) ) )) GROUP BY "jobs"."id";

-- How can I refactor the "works" query to use joins instead of subqueries?  The "does not work" query is my attempt.  Thanks!

backupserver utility

$
0
0
Hi,

is there a limitations when using the sybase backupserver utility on linux(64bit) in terms of performing large DB backup? I'm currently using backupserver utility came from developer edition of ASE 16. If so, how big the size it can handle?

TIA.

SQL0805N Package "NULLID.SQLC2O26 0X4141414141664164" was not found

$
0
0
Hello everyone

I have a problem regarding SQL0805N problem. I can connect to remote db through application account located on this remote server but I can`t select anything. I don`t have an access to this server. I tried many solutions, for example using several bind commands but I receive following message:

SQL0551N The statement failed because the authorization ID does not have the required authorization or privilege to perform the operation. Authorization ID: "VPCENTER". Operation: "BIND". Object: "NULLID.SQLC2O26". SQLSTATE=42501

Which privileges I have to grant to user vpcenter anod how? Should I create this user in my db2 server? My db server is version Db2 Express 11.1 and remote db is version 10.1.5.

Please advice me.

DB2 CREATE TABLE with COLLATE statement

$
0
0
Hello,

Do you know if there is a way to create a TABLE with columns with different collations (This is possible for example with SQL-Server)
I didn't found anything about collate statement in CREATE TABLE documentation and nor any anouncement about it
The goal is to easily show differences to students on sorting and grouping operations, depending on collation

I work on DB2 11.010 for Z/OS

thank you in advance :)

WHUK Pre-Xmas Offer | Avail 25% OFF on Managed WordPress Hosting

$
0
0
WHUK offers WordPress optimized hosting servers in the UK over CloudLinux platform.

Our WordPress Hosting plans make it simple and easy for you to setup your own blog or website with everything needed to get started right away. Every plan comes with WordPress preinstalled – a powerful, easy to use blogging and content management system that powers millions of websites around the world!

Get an exclusive 25% off on WordPress hosting with any billing term. The higher the billing cycle, the higher will be the savings so don’t miss this opportunity and get online today.

Quote:

Use coupon code "WPSAVE25" to avail the offer.
Offer ends on Wednesday 14 December 2016, 11.59pm BST.

Quote:

Initiate a LIVE CHAT with one of our friendly sales advisors to avail up to 25% discount.
Advantages:
  • 24x7 Fully Managed Service at no extra cost
  • Pre-installed WordPress
  • Pre-installed Plugins
  • Free Installation of additional plugins
  • Free Migration & Transfer
  • Free Daily Backups with 7 days Retention
  • Auto Updates
  • Memcache Enabled
  • Varnish Cache and Nginx
  • Bad neighbor isolation


Here’s a list of WordPress Hosting Plans to choose from:

Starter Plans – Ideal for Beginners
  • 1 Free Domain
  • Up to 5 Websites/Blogs Migration/Transfer
  • 2 GB SAS Disk Space
  • Unlimited Bandwidth
  • cPanel Control Panel
  • 25 E-mail Accounts
  • 5 Addon Domains
Price: £3.99 GBP/Month | Order Now

Professional Plans
  • 1 Free Domain
  • Up to 20 Websites/Blogs Migration/Transfer
  • 5 GB SAS Disk Space
  • Unlimited Bandwidth
  • cPanel Control Panel
  • 200 E-mail Accounts
  • 20 Addon Domains
Price: £5.99 GBP/Month | Order Now

Platinum Plans
  • 1 Free Domain
  • Unlimited Websites/Blogs Migration/Transfer
  • 10 GB SAS Disk Space
  • Unlimited Bandwidth
  • cPanel Control Panel
  • Unlimited E-mail Accounts
  • Unlimited Addon Domains
Price: £8.99 GBP/Month | Order Now

For more details about the offers visit: https://www.webhosting.uk.com/wordpress-hosting.php

Leave all your worries about rising cross-site scripting attacks, vulnerabilities, malicious activities, code injections and many other types of threats to us. Now you can simply keep safe your website with our advanced WHUK Site Scanner proven technology to protect and secure your website against malwares, Trojans and vulnerabilities.

To know more features, visit WHUK's Malware Trojan Vulnerability Scanner for Websites

In case you have any questions, you can contact our sales department by initiating a chat or by dropping an email to sales @ webhosting.uk.com or call us on 0800 862 0890 / +44-191-303-8069.

About WHUK:
Established in the year 2001, Webhosting.UK.Com (WHUK) Limited offers a wide array of value for money web hosting services including Linux/Windows Shared Hosting, Reseller Hosting, Cloud Hosting, Virtual Private Servers (VPS), Dedicated Servers, SSL and Offsite Backup Solutions. 24x7x365 technical support is available and 99.95% uptime guarantee is offered as standard features with UK-based servers.

Low Cost High Performance Managed VPS Servers with Full Root Access | 2 US Dataceners

$
0
0
RankFirstHosting.Com has surpassed all of its hosting competitors with an unparallel array of SEO hosting plans and hosting servers. With our VPS server you get complete control and take advantage of a personalized hosting environment that fits best to your own personal particular necessities. Our VPS servers are speedy and cost-effective. Cutting-edge components, full root access and price range makes our VPS server an ideal preference for fast growing corporations.

Following are details of our current range of VPS servers.

☄ VPS SERVER 1 Order Now
1GB Memory
50GB Disk Space
1000GB Bandwidth
5 IP Addresses
$50 per month

☄ VPS SERVER 2 Order Now
2GB Memory
100GB Disk Space
2000GB Bandwidth
10 IP Addresses
$75 per month

☄ VPS SERVER 3 Order Now
3GB Memory
150GB Disk Space
3000GB Bandwidth
15 IP Addresses
$100 per month

☄ VPS SERVER 4 Order Now
4GB Memory
200GB Disk Space
4000GB Bandwidth
20 IP Addresses
$125 per month

☄ VPS SERVER 5 Order Now
5GB Memory
250GB Disk Space
5000GB Bandwidth
30 IP Addresses
$150 per month

Here are some of the features we provide.

> Full root access
> Completely customized hosting environment
> Dedicated Ips
> With / Without cPanels
> Free migration assistance
> Affordable Rates
> State-of-the-art Hardware
> Added security
> Multiple Payment Methods
> Instant Setup
> 24/7/365 expert support
and much more...

For any queries and questions please email us at support[at]rankfirsthosting.com

How to remove #Eerror in query

$
0
0
Hi Guys,

I am creating a new query pulling data from [tbl_Product] and subquery [qry_LatestProductPrice] with outer join to populate all records from [tbl_Product].

[tbl_Product] = ProductID
[qry_LatestProductPrice] = Price

For the blank record in qry_LatestProductPrice, it will display #Error in the Price column.

My question is how to remove the #Error in the blank record or is there any problem with my query.

I have tried IIf(IsNull([Price],0,[Price]) and IIf([Price]=0,0,[Price]) but it is not working.

I hope you guys could help me solve the problem.

Thank you.
tserhung

IO performance issues

$
0
0
Hi,
I want to begin by saying I'm relatively new with Informix and don't have advanced knowledge of how informix works.

I'm opening this thread because of some IO performance issues that I have now and need to be sure of what I must do.

This is my db profile counts:Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
22906487 87848814 34363980245 99.93 332057743 398328761 1082072410 69.31

isamtot open start read write rewrite delete commit rollbk
48406998458 7423608018 9188986012 10875359326 1488886 347373130 682316 347179506 1

gp_read gp_write gp_rewrt gp_del gp_alloc gp_free gp_curs
1487097310 353965214 343076548 4397605 4723657 2 18018239

ovlock ovuserthread ovbuff usercpu syscpu numckpts flushes
0 0 0 457810.60 98673.63 3364 7580

bufwaits lokwaits lockreqs deadlks dltouts ckpwaits compress seqscans
541933 6627626 13923560081 0 0 29422 1170160 807177

ixda-RA idx-RA da-RA logrec-RA RA-pgsused lchwaits
70449 9643446 760355 1294 18020622 137838512

Onconfig:
NETTYPE soctcp,1,200,NET
LISTEN_TIMEOUT 60
MAX_INCOMPLETE_CONNECTIONS 1024
FASTPOLL 1
NUMFDSERVERS 4
NS_CACHE host=900,service=900,user=900,group=900

MULTIPROCESSOR 1
VPCLASS cpu,num=12,noage
VP_MEMORY_CACHE_KB 0
SINGLE_CPU_VP 0
CLEANERS 8
DIRECT_IO 1
LOCKS 20000
DEF_TABLE_LOCKMODE page
RESIDENT 0
SHMBASE 0x44000000L
SHMVIRTSIZE 10485760
SHMADD 262144
EXTSHMADD 51200
SHMTOTAL 62914560
SHMVIRT_ALLOCSEG 0,3
SHMNOACCESS
MAX_PDQPRIORITY 100
DS_MAX_QUERIES
DS_TOTAL_MEMORY
DS_MAX_SCANS 1048576
DS_NONPDQ_QUERY_MEM 256
DATASKIP
BUFFERPOOL default,buffers=10000,lrus=8,lru_min_dirty=50,lru_ max_dirty=60.5
BUFFERPOOL size=2K
BUFFERPOOL size=8K

The machine on which DB runs has 16 cpus and 64 GB of RAM.

These values are not configured by me.

Any ideeas ?

Thanks.

DataGrip — cross-database and cross-platform tool for SQL.

$
0
0
Hi! A year ago JetBrains announced a new tool for databases and SQL — DataGrip.

The most important feature of DataGrip is smart SQL assistance — fast IntelliSense, quick-fixes and understanding what particular objects are used in your query. Here is the full list of features: https://www.jetbrains.com/datagrip/features/

The new release this November brought a new feature: now you can find usages of the table/view inside other views, procedures or functions. Also, 2016.3 version brings the possibility to submit changes to the table in bulk — they are stored locally until you press submit. This is the post about latest features in DataGrip: https://blog.jetbrains.com/datagrip/...16-3-released/

JetBrains also provides free version for:
— Open source projects
— Students
— Those who report many bugs
— Those who use our beta-versions

Structuring a Survey Database scheme

$
0
0
I'm building a database for a survey system.

We have employees that fill in a survey using categories that have questions. The employee can give him/herself a score (for example 6/10). Now we also have coaches which will fill out the same test for that employee.
I created the following database scheme but I'm not sure about the layout. For example:

dbscheme.jpg

A different approach is to get the coach_id in the answers table from the employees, since i'll be using roles anyway to check if a certain employee is a coach..

dbscheme2.jpg

Coaches
I have some users that are coaches, so when a coach_id is filled in in the answers table, we assume that a coach filled in this report. I'm not sure this is the way to go about that?

Employees
I'm using an employees table, they are a type of user.. But for the coaches I don't use a different model. Should I do this? Since a coach is also like an employee but with a different roles. I'm using roles for everything, but I'm just wondering if those employees/coaches tables are needed?

Entities

- clients (or companies) have employees assigned to them. All employees of a client (company) will have to make a scan (survey)
- users are general login-able entities, they have a username, password and have roles
- there's 2 roles **employee** and **coach**, a coach can fill in the survey for certain employees, so we have a score of the employee, and of the coach.
- a category has many questions
- answer (see example just down)
- a scan is a collection of categories and questions, so 1 client (company) can have many scans over the years.


Example Table for Answers

+------------+------------+---------+-----------+
| EmployeeID | QuestionID | CoachID | Answer |
+------------+------------+---------+-----------+
| 1 | 10 | null | 5/10 |
| 2 | 11 | null | 8/10 |
| 3 | 12 | null | 6/10 |
| 1 | 10 | 1 | 5/10 |
| 2 | 11 | 1 | 8/10 |
| 3 | 12 | 1 | 6/10 |
+------------+------------+---------+-----------+


Thank you for your time!
Attached Images

Query - Count drivers grouped by year and month

$
0
0
db2 10 on z/os

I have a table with all driver license information. I need to get a count of drivers who were 16 years old or older grouped by year and month since January 2007. current date - birthday (column in the table) will give me their current age and I can use it to count the number of drivers who are 16+ as of now. But I'm not sure how to do it for every year and month since Jan 2007. Is it possible to do with sql?

Thanks
Viewing all 13329 articles
Browse latest View live