Tag: database

Dynamic attributes for a model

I’m currently creating a document management system where the user should be able to configure the supported document types and therefor the documents attributes. My current conceptional ERD for the template looks like this: but if i would like store my documents in this way, i it would create for each document with 2 attributes […]

Add multiple SQL values with same parameterized query?

I’m fairly new to SQL and trying to figure out the best way to add some predefined data. I figured out from searching around here that I should used a parameterized command to avoid a sql injection attack which isn’t a huge concern in this case but I would like to avoid the possibility and […]

Need assistance with a SQL query

I need help with a query that I can’t seem to figure out how to compose. (SQL Server) I have two tables, “Project” and “ProjectStatus” that have these fields: (I have omitted irrelevant columns) Project PROJID (PK) NAME ProjectStatus STATUSID PROJID (FK, references projid in project table) CHANGEDDATE I want to get a list of […]

SQL auto-create a value column

I have a table in a SQL Server database with columns E-mail, Mobile Number, AuthCode, UserID. When I add a new user, the AuthCode column should be filled with a value like this: UserID+Mobile Number. Like this: if new user has a mobile number of 05518602015 and UserID (Autoincrement) of 2, then the AuthCode column […]

sql select and group by CURRENT_TIMESTAMP

I’m trying to select and group by date from MySQL. table looks like this: `id` int(11) NOT NULL, `run_data` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_day` varchar(20) NOT NULL, `number_of_links` int(20) NOT NULL, for selecting, I’m using: SELECT date_day, SUM(number_of_links) FROM my_table GROUP BY date_day DESC LIMIT 30 I’m getting total number of links per day […]

Update SQL Server database from datagridview

I need to update my database on a local PC with SqlDataAdapter. The project is Windows Forms. This method selects information from database and returns a DataTable to be used as data source for a DataGridView : static string querySelect = “select * from [customers_Sizes] where ID_customers = @ID_customers”; private DataSet recivedData; static public SqlDataAdapter […]

How to check the last time a database table updated

In Sql Server,there is a table called ‘Product’ Is there any way to check the recent time/last time ,when data was populated in ‘Product’ table

Jetbrains Datagrip 2017.1.3, force columns exported when dumping data to sql inserts file

I have an SQL server database with a lot of tables and data. I need to reproduce it locally in a docker container. I have successfully exported the schema and reproduced it. When I dump data to an SQL file, it does not export automatically generated fields (Like ids or uuids for example) Here is […]

Design SQL Server database correctly

I have simple registration form, but there are 3 checkboxes for example: Name: [ ] Email: [ ] Pass: [ ] What do you like at free time? Reading: [ ] Travelling: [ ] Sport: [ ] As in example above you see “What do you like at free time?” There are 3 checkboxes. There […]

SQL – Why Does This Happen?

These are the tables that I’m working with. With that in mind, I want to showcase the Employees that are both a supervisor and a manager. But when I used this select e1.fname,e1.lname from employee e1,employee e2,department where e1.ssn=e2.super_ssn and e1.ssn = Mgr_ssn This was the output I know I can solve the problem with […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.